View source code
Display the source code in std/random.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Alias std.random.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.

alias Mt19937_64 = MersenneTwisterEngine!(ulong,64L,312L,156L,31L,-5403634167711393303L,29L,6148914691236517205L,17L,8202884508482404352L,37L,-2270628950310912L,43L,6364136223846793005L);

Example

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

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

Authors

Andrei Alexandrescu Masahiro Nakagawa (Xorshift random generator) Joseph Rushton Wakeling (Algorithm D for random sampling) Ilya Yaroshenko (Mersenne Twister implementation, adapted from mir-random)

License

Boost License 1.0.