rand_init

This routine initializes, with up to 4 seeds, a randomn number sequence. The generator being primed is an F90 port of an xorshift generator described in Marsaglia, Journal of Statistical Software 2003, vol 8. It has a theoretical period of $2^{128} - 1 \approx 3.4 10^{38}$. Please refer to the “Comment on Random Number Generator” in the Fortran90 facilities guidelines.

Location in HEALPix directory tree: src/f90/mod/rngmod.f90 


FORMAT

call rand_init( rng_handle, [seed1, seed2, seed3, seed4] )


ARGUMENTS

name & dimensionality kind in/out description
       
rng_handle planck_rng OUT structure of type planck_rng containing on output all information necessary to continue same random sequence.
seed1 (OPTIONAL) I4B IN first seed of the random sequence. Can be of arbitray sign. If set to zero or not provided will be replaced internally by a non-zero hard coded value.
seed2 (OPTIONAL) I4B IN second seed. Same properties as above
seed3 (OPTIONAL) I4B IN third seed. Same as above.
seed4 (OPTIONAL) I4B IN fourth seed. Same as above.


EXAMPLE:

use rngmod
type(planck_rng) :: rng_handle
call rand_init(rng_handle, 12345, 6789012)
initiates a random sequence with the pair of seeds (12345, 6789012).


RELATED ROUTINES

This section lists the routines related to rand_init

planck_rng
derived type describing RNG state
rand_gauss
function which returns a random normal deviate.
rand_uni
function which returns a random uniform deviate.

Version 3.82, 2022-07-28