Comparing random sequences between Julia, Numpy, MATLAB



Is there a way to set the rng’s in Julia, Numpy, and MATLAB to produce the same sequence? I’m not looking to do something fancy with multithreading, I just want to compare/debug output where all codes are producing the same sequence with, for instance, the default Mersenne Twister algorithm.


I would just generate it in one language and load it into the others.


Even with the exact same stream of random numbers, you may not get exactly the same results in different languages. Especially if some calculations are nonlinear (eg branches on values). Even using the same version of Julia & libraries with the same RNG seed on two different machines can get you different results.


See also some previous discussion here: Rand in Julia vs MATLAB