Skip to content
The Mersenne Twister pseudo-random number generator implemented in Python
Python
Branch: master
Clone or download
Latest commit 11b075d Aug 4, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md updated readme Aug 4, 2016
mersenne_twister.py updated readme Aug 4, 2016

README.md

MTP - The Mersenne Twister Pseudo-random number generator

MTP is an implementation of the 32-bit Mersenne Twister pseudo-random number generator in Python. This is the same RNG that Python's 'random' module uses, as well as many other programming languages including R, Matlab, Ruby, Julia, and Common Lisp.

Most of my understanding of this algorithm came thanks to the following sites:

Usage

To initialize the RNG:

generator = mersenne_rng(seed = 123)

If you don't pass it a seed, it will default to 5489

To generate a random number:

random_number = generator.get_random_number()
You can’t perform that action at this time.