Module for pseudo random number generation. The internal pseudo random generator is the xoroshiro128plus method.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private, | parameter | :: | dp | = | kind(0.0d0) | |
| integer, | private, | parameter | :: | i4 | = | selected_int_kind(9) | |
| integer, | private, | parameter | :: | i8 | = | selected_int_kind(18) |
Parallel random number generator type
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(rng_t), | public, | allocatable | :: | rngs(:) |
| procedure, public, non_overridable :: init_parallel |
Random number generator type, which contains the state
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=i8), | private | :: | s(2) | = | [123456789_i8, 987654321_i8] |
The rng state (always use your own seed) |
| procedure, public, non_overridable :: circle | |
| procedure, public, non_overridable :: int_4 | |
| procedure, public, non_overridable :: int_8 | |
| procedure, public, non_overridable :: jump | |
| procedure, public, non_overridable :: next | |
| procedure, public, non_overridable :: normal | |
| procedure, public, non_overridable :: poisson | |
| procedure, public, non_overridable :: set_seed | |
| procedure, public, non_overridable :: sphere | |
| procedure, public, non_overridable :: two_normals | |
| procedure, public, non_overridable :: unif_01 | |
| procedure, public, non_overridable :: unif_01_vec |
Sample point on a circle with given radius
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self | |||
| real(kind=dp), | intent(in) | :: | radius |
Return 4-byte integer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self |
Return 8-byte integer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self |
Interal routine: get the next value (returned as 64 bit signed integer)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self |
Single normal random number
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self |
Return Poisson random variate with rate lambda. Works well for lambda < 30 or so. For lambda >> 1 it can produce wrong results due to roundoff error.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self | |||
| real(kind=dp), | intent(in) | :: | lambda |
Helper function for next()
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | x | |||
| integer, | intent(in) | :: | k |
added for nvidia compilers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | val | |||
| integer, | intent(in) | :: | shift |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i8), | intent(in) | :: | val | |||
| integer, | intent(in) | :: | shift |
Sample point on a sphere with given radius
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self | |||
| real(kind=dp), | intent(in) | :: | radius |
Return two normal random variates with mean 0 and variance 1. http://en.wikipedia.org/wiki/Marsaglia_polar_method
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self |
Set a seed for the rng
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self | |||
| integer(kind=i8), | intent(in) | :: | the_seed(2) |
Fill array with uniform random numbers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self | |||
| real(kind=dp), | intent(out) | :: | rr(:) |