randRange

Turn a random number generator function into an infinite range. Params is a tuple of the distribution parameters. This is specified in the same order as when calling the function directly.

The sequence generated by this range is deterministic and repeatable given the state of the underlying random number generator. If the underlying random number generator is explicitly specified, as opposed to using the default thread-local global RNG, it is copied when the struct is copied. See below for an example of this behavior.

RandRange!(randFun, T)
randRange
(
alias randFun
T...
)
()

Examples

1 // Print out some summary statistics for 10,000 Poisson-distributed
2 // random numbers w/ Poisson parameter 2.
3 auto gen = Random(unpredictableSeed);
4 auto pois1k = take(10_000, randRange!rPoisson(2, gen));
5 writeln( summary(pois1k) );
6 writeln( summary(pois1k) );  // Exact same results as first call.

Meta