Is there any good open-source implementation of Mersenne Twister and other good random number generators in Python available? I would like to use in for teaching math and comp sci majors? I am also looking for the corresponding theoretical support.
Edit: Source code of Mersenne Twister is readily available in various languages such as C (random.py
) or pseudocode (Wikipedia) but I could not find one in Python.
Found following port:
Not very pythonic but works
Mersenne Twister is an implementation that is used by standard python library. You can see it in
random.py
file in your python distribution.On my system (Ubuntu 9.10) it is in
/usr/lib/python2.6
, on Windows it should be inC:\Python26\Lib