The OpenD Programming Language

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

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

Meta