Is there some way to make the random number generator in numpy generate the same random numbers as in Matlab, given the same seed?
I tried the following in Matlab:
>> rng(1);
>> randn(2, 2)
ans =
0.9794 -0.5484
-0.2656 -0.0963
And the following in iPython with Numpy:
In [21]: import numpy as np
In [22]: np.random.seed(1)
In [23]: np.random.randn(2, 2)
Out[23]:
array([[ 1.624, -0.612],
[-0.528, -1.073]])
Values in both the arrays are different.
Or could someone suggest a good idea to compare two implementations of the same algorithm in Matlab and Python that uses random number generation.
Thanks!