Next: , Previous: , Up: Random Number Generators   [Contents][Index]


9.5 Template parameters

RNGs take three template parameters, all of which have default values. Using the Uniform RNG as an example, the template parameters of Uniform<T, IRNG, stateTag> are:

T

is the type of random number to generate (one of float, double, or long double for continuous distributions; an integer type for discrete distributions). Note that generating double and long double RNGs takes longer, because filling the entire mantissa with random bits requires several random integers. The default parameter for most generators is float.

IRNG

is the underlying Integer RNG to use. The default is MersenneTwister.

stateTag

is either sharedState or independentState. If sharedState, the IRNG is shared with other generators. If independentState, the RNG contains its own IRNG. The default is sharedState.