Class that generates pseudo random numbers. See Prng_Class for more information on how to use this class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=i64), | public | :: | seed(0:15) | = | 0 | ||
integer(kind=i32), | public | :: | ptr | ||||
logical, | public | :: | big |
Overloaded Initializer for a Prng - Pseudo random number generator. Thread safe, xorshift1024* or xorshift128+ generator than can draw from different distributions. See Prng_Class for more information on how to use this class.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=i64), | intent(in) | :: | seed(:) | Fixed seeds of 64 bit integers. If big == true, must be length 16 else must be length 2. |
||
logical, | intent(in), | optional | :: | big | Use the high period xorshift1024* (true) or xorshift128+ (false). Default is false. |
Prng Class
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in), | optional | :: | big | Use the high period xorshift1024* (true) or xorshift128+ (false). Default is false. |
|
logical, | intent(in), | optional | :: | display | Display the randomly generated seed to the screen for reproducibility |
Prng Class
Jumps the Prng by \(2^{64}\) numbers if the Prng was instantiated with big = .false. or \(2^{512}\) if big = .true. This allows the Prng to be used correctly in parallel on multiple threads for OpenMP, or ranks for MPI.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Prng), | intent(inout) | :: | this | Prng Class |
||
integer(kind=i32) | :: | nJumps | Number of times to skip \(2^{64}\) numbers if the Prng was initialized with big = .false. or $2^{512}$ numbers if big was .true. |
Prng%rngExponential() - Draw from an exponential distribution $$y = \frac{-ln(\tilde{u})}{\lambda}$$ where \(\tilde{u}\) is a sample from a uniform distribution
Prng%rngInteger() - Draw a random integer in the interval \(x_{0} <= \tilde{u} <= x_{1}\) $$y = x_{0} + (\tilde{u} * x_{1})$$ where \(\tilde{u}\) is a sample from a uniform distribution, and integers are generated such that \(x_{0} <= \tilde{u} <= x_{1}\).
Prng%rngNormal() - Draw from a normal distribution.
Prng%rngUniform() - Draw from a uniform distribution Draws uniform random numbers on (0, 1) using either the xorshift1024* or xorshift128+ algorithms.
Prng%rngWeibull() - Draw from a Weibull distribution $$y = \left[ \frac{-1}{\lambda} ln(\tilde{u}) \right]^{\frac{1}{k}}$$ where \(\tilde{u}\) is a sample from a uniform distribution and \(\frac{-1}{\lambda} ln(\tilde{u})\) is a draw from an exponential distribution.