Function std.random.unpredictableSeed
A "good" seed for initializing random number engines. Initializing with unpredictableSeed makes engines generate different random number sequences every run.
uint unpredictableSeed() nothrow @property @nogc @trusted;
Function unpredictableSeed
Alias unpredictableSeed
Returns
A single unsigned integer seed value, different on each successive call
Note
In general periodically 'reseeding' a PRNG does not improve its quality
and in some cases may harm it. For an extreme example the Mersenne
Twister has 2 ^^ 19937 - 1
distinct states but after seed(uint)
is
called it can only be in one of 2 ^^ 32
distinct states regardless of
how excellent the source of entropy is.
Example
auto rnd = Random(unpredictableSeed);
auto n = rnd .front;
static assert(is(typeof(n) == uint));
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)