I want to know how to create the same random (normal distribution) number in numpy, like in MATLAB.
As an example, when I do this in MATLAB
RandStream.setGlobalStream(RandStream('mt19937ar','seed',1));
rand
ans =
0.417022004702574
Now I can reproduce this with numpy:
import numpy as np
np.random.seed(1)
np.random.rand()
0.417022004702574
This is good, but when I do it with a normal distribution, I get different numbers.
RandStream.setGlobalStream(RandStream('mt19937ar','seed',1));
randn
ans =
-0.649013765191241
And with numpy
import numpy as np
np.random.seed(1)
np.random.randn()
1.6243453636632417
Both functions say in their documentation that they draw from the standard normal distribution, but give me different results. Any idea how I can configure my python / numpy to get the same numbers as MATLAB.
- :
, .
, , .
.