Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Mersenne Twister
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Characteristics == {{procon|section|date=March 2024}} Advantages: * [[Permissive software licence|Permissively-licensed]] and patent-free for all variants except CryptMT. * Passes numerous tests for statistical randomness, including the [[Diehard tests]] and most, but not all of the [[TestU01]] tests.<ref name="TestU01">P. L'Ecuyer and R. Simard, "[http://www.iro.umontreal.ca/~lecuyer/myftp/papers/testu01.pdf TestU01: "A C library for empirical testing of random number generators]", ''[[ACM Transactions on Mathematical Software]]'', 33, 4, Article 22 (August 2007).</ref> * A very long period of <math>2^{19937}-1</math>. Note that while a long period is not a guarantee of quality in a random number generator, short periods, such as the <math>2^{32}</math> common in many older software packages, can be problematic.<ref>Note: 2<sup>19937</sup> is approximately 4.3 × 10<sup>6001</sup>; this is many orders of magnitude larger than the estimated number of particles in the [[Observable universe#Matter content|observable universe]], which is 10<sup>87</sup>.</ref> * [[#k-distribution|''k''-distributed]] to 32-bit accuracy for every <math>1 \le k \le 623</math> * Implementations generally create random numbers faster than hardware-implemented methods. A study found that the Mersenne Twister creates 64-bit floating point random numbers approximately twenty times faster than the hardware-implemented, processor-based [[RDRAND]] instruction set.<ref>{{cite journal|last1=Route|first1=Matthew|date=August 10, 2017|title=Radio-flaring Ultracool Dwarf Population Synthesis|journal=The Astrophysical Journal|volume=845|issue=1|page=66|arxiv=1707.02212|bibcode=2017ApJ...845...66R|doi=10.3847/1538-4357/aa7ede|s2cid=118895524 |doi-access=free }}</ref> Disadvantages: * Relatively large state buffer, of almost 2.5 [[Kilobyte|kB]], unless the TinyMT variant is used. * Mediocre throughput by modern standards, unless the SFMT variant (discussed below) is used.<ref>{{cite web|title=SIMD-oriented Fast Mersenne Twister (SFMT): twice faster than Mersenne Twister|url=http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/|access-date=27 March 2017|website=Japan Society for the Promotion of Science}}</ref> * Exhibits two clear failures (linear complexity) in both Crush and BigCrush in the TestU01 suite. The test, like Mersenne Twister, is based on an <math>\textbf{F}_2</math>-algebra.<ref name="TestU01" /> * Multiple instances that differ only in seed value (but not other parameters) are not generally appropriate for [[Monte-Carlo simulation|Monte-Carlo simulations]] that require independent random number generators, though there exists a method for choosing multiple sets of parameter values.<ref>{{cite web|author1=Makoto Matsumoto|author2=Takuji Nishimura|title=Dynamic Creation of Pseudorandom Number Generators|url=http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/DC/dgene.pdf|access-date=19 July 2015}}</ref><ref>{{cite web|author1=Hiroshi Haramoto|author2=Makoto Matsumoto|author3=Takuji Nishimura|author4=François Panneton|author5=Pierre L'Ecuyer|title=Efficient Jump Ahead for F2-Linear Random Number Generators|url=http://www.iro.umontreal.ca/~lecuyer/myftp/papers/jumpf2.pdf|access-date=12 Nov 2015}}</ref> * Poor diffusion: can take a long time to start generating output that passes [[randomness test]]s, if the initial state is highly non-random—particularly if the initial state has many zeros. A consequence of this is that two instances of the generator, started with initial states that are almost the same, will usually output nearly the same sequence for many iterations, before eventually diverging. The 2002 update to the MT algorithm has improved initialization, so that beginning with such a state is very unlikely.<ref>{{cite web|title=mt19937ar: Mersenne Twister with improved initialization|url=http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html|access-date=4 October 2015|work=hiroshima-u.ac.jp}}</ref> The GPU version (MTGP) is said to be even better.<ref name="fog">{{cite journal|last1=Fog|first1=Agner|date=1 May 2015|title=Pseudo-Random Number Generators for Vector Processors and Multicore Processors|journal=Journal of Modern Applied Statistical Methods|volume=14|issue=1|pages=308–334|doi=10.22237/jmasm/1430454120|doi-access=free}}</ref> * Contains subsequences with more 0's than 1's. This adds to the poor diffusion property to make recovery from many-zero states difficult. * Is not [[CSPRNG|cryptographically secure]], unless the [[CryptMT]] variant (discussed below) is used. The reason is that observing a sufficient number of iterations (624 in the case of MT19937, since this is the size of the state vector from which future iterations are produced) allows one to predict all future iterations.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Mersenne Twister
(section)
Add topic