python - Consistenly create same random numpy array -


i waiting developer finish piece of code return np array of shape (100,2000) values of either -1,0, or 1.

in meantime, want randomly create array of same characteristics can head-start on development , testing. thing want randomly created array same each time, i'm not testing against array keeps changing value each time re-run process.

i can create array this, there way create it's same each time. can pickle object , unpickle it, wondering if there's way.

r = np.random.randint(3, size=(100, 2000)) - 1 

simply seed random number generator fixed value, e.g.

numpy.random.seed(42) 

this way, you'll same random number sequence.


Comments