lundi 18 septembre 2017

What is the best way to generate random points using numpy? [duplicate]

This question already has an answer here:

I want to generate n random points in d dimensions using numpy. This is the simple solution that I came so far:

def generatePoints(n, d):
  points = np.empty((n, d))
  for point in points:
    for i in range(points.shape[1]):
      point[i] = random.uniform(1.0, 10.0)

Is there any best way to do this?




Aucun commentaire:

Enregistrer un commentaire