np.random.seed
np.random.seed(1234)
np.random.uniform(0, 10, 5)
#array([ 1.9151945 , 6.22108771, 4.37727739, 7.85358584, 7.79975808])
np.random.rand(2,3)
#array([[ 0.27259261, 0.27646426, 0.80187218],
# [ 0.95813935, 0.87593263, 0.35781727]])
If you want to use the class, you must save an instance of the class, initiated with a seed: nprandom.RandomState
r = np.random.RandomState(1234)
r.uniform(0, 10, 5)
#array([ 1.9151945 , 6.22108771, 4.37727739, 7.85358584, 7.79975808])
And it maintains the state just as before:
r.rand(2,3)
#array([[ 0.27259261, 0.27646426, 0.80187218],
# [ 0.95813935, 0.87593263, 0.35781727]])
You can see the state of the sort of 'global' class with
np.random.get_state()
and of your own class instance with
r.get_state()