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) |
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 |
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 |
Fill array with uniform random numbers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(rng_t), | intent(inout) | :: | self | |||
| real(kind=dp), | intent(out) | :: | rr(:) |
type rng_t !> The rng state (always use your own seed) integer(i8), private :: s(2) = [123456789_i8, 987654321_i8] contains procedure, non_overridable :: set_seed ! Seed the generator procedure, non_overridable :: jump ! Jump function (see below) procedure, non_overridable :: int_4 ! 4-byte random integer procedure, non_overridable :: int_8 ! 8-byte random integer procedure, non_overridable :: unif_01 ! Uniform (0,1] real procedure, non_overridable :: unif_01_vec ! Uniform (0,1] real vector procedure, non_overridable :: normal ! One normal(0,1) number procedure, non_overridable :: two_normals ! Two normal(0,1) samples procedure, non_overridable :: poisson ! Sample from Poisson-dist. procedure, non_overridable :: circle ! Sample on a circle procedure, non_overridable :: sphere ! Sample on a sphere procedure, non_overridable :: next ! Internal method end type rng_t