haneulkim
haneulkim

Reputation: 4928

How can I generate a seed for np.random.uniform?

I am trying to create 50 different cities with their latitudes and longitudes however each time I run I want the coordinates to be same.

lat = np.random.uniform(low=-90, high=90, size=50)
long = np.random.uniform(low=-180, high=180, size=50)

How can I provide a seed?

Upvotes: 2

Views: 3267

Answers (1)

Istvan
Istvan

Reputation: 8562

You can do as follow:

np.random.seed(42)
lat = np.random.uniform(low=-90, high=90, size=50)
long = np.random.uniform(low=-180, high=180, size=50)

Upvotes: 3

Related Questions