question about random number generation

Terry Reedy tjreedy at udel.edu
Fri Sep 10 17:00:08 EDT 2004


<Lu.Fan at seagate.com> wrote in message 
news:OFE5B98598.1EC05A6B-ON87256F0B.005E056A at seagate.com...

We have a system developed in Python. Now I'm writing tests in Java 
(actually a Java wrapper) to test it. I need to duplicate a random number 
generation process in my test which means that given the same seed I expect 
the same result in Java as in Python. As far as I know, Python uses the 
Mersenne Twister RNG --- correct me if I am wrong. Do Python and Java use 
the same RNG?
------------------------------------------------------------------
Python used to use something else and might use something else again in the 
future.  The only way to have cross language determinism is to only use 
integer arithmetic in routine you write yourself.

Terry J. Reedy






More information about the Python-list mailing list