The OpenD Programming Language

Mt19937_64

A MersenneTwisterEngine instantiated with the parameters of the original engine MT19937-64, generating uniformly-distributed 64-bit numbers with a period of 2 to the power of 19937.

import std.random;
alias Mt19937_64 = MersenneTwisterEngine!(ulong, 64, 312, 156, 31, 0xb5026f5aa96619e9, 29, 0x5555555555555555, 17, 0x71d67fffeda60000, 37, 0xfff7eee000000000, 43, 6_364_136_223_846_793_005)

Examples

// Seed with a constant
auto gen = Mt19937_64(12345);
auto n = gen.front; // same for each run
assert(n == 6597103971274460346);

// Seed with an unpredictable value
gen.seed(unpredictableSeed!ulong);
n = gen.front; // different across runs

Meta