Constructs a LinearCongruentialEngine generator seeded with x0.
Advances the random sequence.
(Re)seeds the generator.
Returns the current number in the random sequence.
Always false (random generators are infinite ranges).
Does this generator have a fixed range? (true).
Mark this as a Rng
Highest generated value (modulus - 1).
Lowest generated value (1 if c == 0, 0 otherwise).
Declare your own linear congruential engine
alias CPP11LCG = LinearCongruentialEngine!(uint, 48271, 0, 2_147_483_647); // seed with a constant auto rnd = CPP11LCG(42); auto n = rnd.front; // same for each run assert(n == 2027382);
Declare your own linear congruential engine
// glibc's LCG alias GLibcLCG = LinearCongruentialEngine!(uint, 1103515245, 12345, 2_147_483_648); // Seed with an unpredictable value auto rnd = GLibcLCG(unpredictableSeed); auto n = rnd.front; // different across runs
Declare your own linear congruential engine
// Visual C++'s LCG alias MSVCLCG = LinearCongruentialEngine!(uint, 214013, 2531011, 0); // seed with a constant auto rnd = MSVCLCG(1); auto n = rnd.front; // same for each run assert(n == 2745024);
Linear Congruential generator. When m = 0, no modulus is used.