The Mersenne Twister RNG for GNU Octave is a module facilitating the use of the Mersenne Twister MT19337 RNG for any Octave user.
The file cokus.c provides actual ANSI C implementation of the RNG, and it has been written by Shawn Cokus. Unlike other RNGs, this one comes with an improved implementation of the very long period, fast and memory-efficient Mersenne Twister Random Number Generator by Makoto Matsumoto and Takuji Nishimura.
This RNG uses a twisted generalized feedback shift-register algorithm that has a Mersenne prime period of 2^19937 - 1, which is equivalent to about 10^6000, and is equi-distributed in 623 dimensions. Additionally, it has passed the `DIEHARD' statistical tests by Marsaglia, yet it remains extremely fast and efficient in terms of memory usage.
The code has been tested on 32bit (i386) and 64bit (alpha) versions of Linux. Beyond the actual MT implementation by Shawn Cokus, there is one routine from the RANDLIB library that was used to transform uniform into standard normal deviates. The routine is called Ahrens and Dieter (1973), and it was combined with the pieces to provide simple C++ wrappers that allow Octave to access the code.
Also included in the package is a Makefile and a simple Octave script that users can use to time the MT RNG against Octave's default RNG from RANDLIB. Provided mkoctfile is in your PATH, you can build the Octave modules randmt.oct, randmtn.oct, and randmtseed.oct just by typing "make."
Lastly, the "compare_rngs.m" Octave script can be used to time this RNG against the default RNG. This package is released under the GNU GPL, just like Octave, the MT, and RANDLIB. With all these features, the Mersenne Twister RNG for GNU Octave is an unrivaled software that any Octave user should consider.
Version -: N/A