Is there guarantee that pyhon2/python3 script with random generator initialized with random.setstate() or random.seed() will produce same sequence of pseudo-randomness across different versions and platforms ? (for example python 3.1 on Mac , the same as python 3.2 on Linux 64-bit)
Question is about both: python2 and python3, with assumption that python3 scripts will run on python3 interpreters and vice versa.
Python 2.3 and up use the Mersenne Twister generator, which is independent of the system random function (implemented as a C extension module for Python). For any version using the Mersenne Twister, the results should be the same across versions and platforms.
Previously, you could guarantee backwards compatibility using the
WichmannHillgenerator, but unfortunately it seems that has been removed in Python 3.x.If you absolutely need to guarantee compatibility, write your own
Randomsubclass (or use a stable external implementation, e.g. simplerandom) as recommended by therandomdocumentation: