How do I get the same random numbers in Python and Matlab?
For example, my Matlab code prints random integers of 1 and 2 with the given seed:
>> rng(1);
>> randi(2,1,10)
ans =
1 2 1 1 1 1 1 1 1 2
However, when I have the same seed using NumPy, I get a different order of random numbers:
np.random.seed(1)
np.random.randint(1,3,10)
array([2, 2, 1, 1, 2, 2, 2, 2, 2, 1])
Is there any way the two methods can produce the same order of random numbers?