This module implements a number of pseudo random number generators (prngs) selected according to their efficiency and their satisfactory statistical properties:
Period indicates how many samples the prng is guaranteed to produce before starting to repeat the same sequence again. All the prng here implemented obtain uniform real numbers starting from integer numbers. Resolution indicates how many bits are used by the prng for these integer numbers. A higher resolution corresponds to a finer grid of possible real numbers on (0,1). In standard use cases a resolution higher than 2^32 is not needed.
Ecuyer07 provides an overview of many prngs including the ones provided by this module. The TestU01 library has been used to assess the statistical properties of the prngs here implemented. More in detail, they all pass the most stringent battery of tests provided by the TestU01 library (big crush).
In the following
rng represents a generic prng.
Returns independent and identically distributed random numbers which are uniformly distributed over the interval (0,1) extremes excluded.
Returns an independent copy of the prng which is initialized with the same state of
rng. This means that both
rngcopy generate the same sequence of random numbers from this point onward. It allows for the re-use of the same sequence of random numbers multiple times without having to store them.
Returns a string representing a serialization of the
rng state. It allows to persist the
rng between multiple runs of a simulation by for instance saving the string state to a file.
Takes as input a string returned from a call to
tostring(rng) and returns a
rng initialized with such state.
Default choice for a prng (chosen among the ones listed below) based on its efficiency and statistical properties. This should be the default choice for users who do not have a strong preference for any specific pseudo random number generators.
Returns a prng based on the lfib4 algorithm according to Marsaglia99.
Returns a prng based on the kiss99 algorithm according to Marsaglia99.
Returns a prng based on the mrg32k3a parametrization according to Ecuyer99.