Overview
Mersenne Twister maintains a large internal state and twists it to produce high-quality deterministic pseudorandom sequences.
Generates pseudorandom numbers with a very long period.
Compact metadata for implementation and discovery.
Mersenne Twister maintains a large internal state and twists it to produce high-quality deterministic pseudorandom sequences.
Quick facts
Runtime and memory behavior at a glance.
Best
O(1)
Average
O(1)
Worst
O(1)
Space
O(1)
x[i] = x[i + m] xor ((upper(x[i]) | lower(x[i + 1])) >> 1) xor twist_constantRefreshes the generator state by mixing separated state entries.
Show a state array twisting into generated numbers.
Mersenne Twister operates in O(1) time and O(1) space within the Pseudorandom Number Generator family. Key governing relation: x[i] = x[i + m] xor ((upper(x[i]) | lower(x[i + 1])) >> 1) xor twist_constant. Often compared with Linear Congruential Generator and Box-Muller Transform.
What each reference supports for this entry.
Original reference for the MT19937 pseudorandom generator and equidistribution properties.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Randomness & Sampling · Core
Mersenne Twister has a much longer period than simple LCGs.
Compare with thisMersenne Twister has a much longer period than simple LCGs.
Monte Carlo simulations require pseudorandom samples.