I am a bit confused on what random.seed()
does in Python. For example, why does the below trials do what they do (consistently)?
>>> i
Here is my understanding. Every time we set a seed value, a "label" or " reference" is generated. The next random.function call is attached to this "label", so next time you call the same seed value and random.function, it will give you the same result.
np.random.seed( 3 )
print(np.random.randn()) # output: 1.7886284734303186
np.random.seed( 3 )
print(np.random.rand()) # different function. output: 0.5507979025745755
np.random.seed( 5 )
print(np.random.rand()) # different seed value. output: 0.22199317108973948