james727 / MTP

The Mersenne Twister pseudo-random number generator implemented in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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()

About

The Mersenne Twister pseudo-random number generator implemented in Python


Languages

Language:Python 100.0%