unpredictableSeed

A "good" seed for initializing random number engines. Initializing with unpredictableSeed makes engines generate different random number sequences every run.

  1. uint unpredictableSeed [@property getter]
    @property @trusted nothrow @nogc
    uint
    unpredictableSeed
    ()
  2. template unpredictableSeed(UIntType)

Return Value

Type: uint

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.

Examples

auto rnd = Random(unpredictableSeed);
auto n = rnd.front;
static assert(is(typeof(n) == uint));

Meta