lundi 28 novembre 2016

How to generate random points in a square using numpy.random.uniform?

Generate 20 random points in the square −5,5 ×[−5,5] (that is, both x and y coordinates are chosen at random with equal probability from the interval [-5,5]). Plot all those points.

I do not understand how to generate those 20 random points and the asnswer to the question I was given which is :

import numpy as np

points = np.random.uniform(-5,5,(50,2))

I do not understand the second part of the numpy function, "(50,2)".

Thank you very much for your help.




Aucun commentaire:

Enregistrer un commentaire