Welcome to mrg32k3a’s documentation!¶
This package provides a Python implementation of the mrg32k3a pseudo-random number generator of L’Ecuyer (1999) and L’Ecuyer et al. (2002). It extends the implementation used in PyMOSO to handle streams, substreams, and subsubstreams. The generator’s period of \(~2^{191}\) is split into \(~2^{50}\) streams of length \(2^{141}\), each containing \(2^{47}\) substreams of length \(2^{94}\), each containing \(2^{47}\) subsubstreams of length \(2^{47}\).
Details¶
The mrg32k3a module includes the MRG32k3a class and several useful functions for controlling the generators.
The
MRG32k3aclass is a subclass of Python’srandom.Randomclass and therefore inherits easy-to-use methods for generating random variates. E.g., ifrngis an instance of theMRG32k3aclass, the commandrng.normalvariate(mu=2, sigma=5)generates a normal random variate with mean 2 and standard deviation 5. Normal random variates are generated via inversion using the Beasley-Springer-Moro algorithm.The
MRG32k3aclass expands the suite of functions for random-variate generation available inrandom.Randomto includelognormalvariate,mvnormalvariate,poissonvariate,gumbelvariate,binomialvariate. Additionally, the methodsinteger_random_vector_from_simplexandcontinuous_random_vector_from_simplexgenerate discrete and continuous vectors from a symmetric non-negative simplex.The
advance_stream,advance_substream, andadvance_subsubstreamfunctions advance the generator to the start of the next stream, substream, or subsubstream, respectively. They make use of techniques for efficiently “jumping ahead,” as outlined by L’Ecuyer (1990).The
reset_stream,reset_substream, andreset_subsubstreamfunctions reset the generator to the start of the current stream, substream, or subsubstream, respectively.
References¶
Cooper, Kyle and Susan R. Hunter (2020). “PyMOSO: Software for multi-objective simulation optimization with R-PERLE and R-MinRLE.” INFORMS Journal on Computing 32(4): 1101-1108.
L’Ecuyer, Pierre (1990). “Random numbers for simulation.” Communications of the ACM 33(10):85-97.
L’Ecuyer, Pierre (1999). “Good parameters and implementations for combined multiple recursive random number generators.” Operations Research 47(1):159-164.
L’Ecuyer, Pierre, Richard Simard, E Jack Chen, and W. David Kelton (2002). “An object-oriented random number package with many long streams and substreams.” Operations Research 50(6):1073-1075.