A wrapper module for random number generator. This module provides real function ranf using intrinsic random_number/random_seed or Mersenne Twister 19937 (see mt19937.f90).
Returns a pseudorandom number range in [0., 1.), (i.e. 0<= ranf < 1). The generator is initialized with the given seed if passed, otherwise uses the seed already set (default or otherwise).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | optional | :: | seed |
Gets the length of the integer vector for the random number generator seed. This is always 1 for the Mersenne case but otherwise depends on the compiler version.
Returns an array of integers to use as a seed to the random number generator given a single integer as input.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | initial_seed |
Simple PRNG derived from gfortran documentation Intended to be used to seed a better PRNG. Probably shouldn't be used directly (hence why this is not public).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=kind_id), | intent(inout) | :: | s |
Returns the current value of the generator seed. This is not currently supported by the Mersenne generator so in this case we return 0.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out), | dimension(:) | :: | seed |
Seed the choosen random number generator.
If randomize=T, a random seed based on date and time is used.
(this randomizing procedure is proposed in GNU gfortran manual.)
Otherwise, it sets the seed using init_seed
In either case, it sets init_seed
to the initial seed used on return.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | randomize | |||
integer, | intent(inout), | dimension(:) | :: | init_seed |
Sets the seed for the random number generator provided by the standard based on a single integer. We use create_seed_from_single_integer to ensure we have enough values in the series rather than just duplicating this number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | initial_seed |