MinstdRand0

LinearCongruentialEngine generators with well-chosen parameters. MinstdRand0 implements Park and Miller's "minimal standard" generator, which uses 16807 for the multiplier. MinstdRand implements a variant that has slightly better spectral behaviour by using the multiplier 48271. Both generators are rather simplistic.

alias MinstdRand0 = LinearCongruentialEngine!(uint, 16807, 0, 2147483647)

Examples

// Initialize generator seeded with constant default value
auto rng0 = new MinstdRand0;
auto n = rng0.front;  // same for each run
// Seed with an unpredictable value
rng0.seed(unpredictableSeed);
n = rng0.front;  // different across runs

// Initialize a different generator with an unpredictable seed
auto rng = new MinstdRand(unpredictableSeed);

Meta