Restarts or queries the pseudo-random number generator used by RANDOM_NUMBER.
There must either be exactly one or no arguments present.
+-------------------------------IBM Extension--------------------------------+
+----------------------------End of IBM Extension----------------------------+
+-------------------------------IBM Extension--------------------------------+
Random_seed allows the user to toggle between two random number generators. Generator 1 is the default. Each generator maintains a private seed and normally resumes its cycle after the last number it generated.
Generator 1 uses the multiplicative congruential method, with
S(I+1) = ( 16807.0 * S(I) ) mod (2.0**31-1)
and
X(I+1) = S(I+1) / (2.0**31-1)
Generator 1 cycles after 2**31-2 random numbers.
Generator 2 also uses the multiplicative congruential method, with
S(I+1) = ( 44,485,709,377,909.0 * S(I) )
mod (2.0**48)
and
X(I+1) = S(I+1) / (2.0**48)
Generator 2 cycles after (2**46) random numbers. Although generator 1 is the default (for reasons of backwards compatibility) the use of generator 2 is recommended for new programs since it typically runs faster than generator 1 and has a longer period.
If no argument is present, the seed of the current generator is set to the default value 1d0.
+----------------------------End of IBM Extension----------------------------+
Class
Subroutine
Examples
CALL RANDOM_SEED
! Current generator sets its seed to 1d0
CALL RANDOM_SEED (SIZE = K)
! Sets K = 64 / BIT_SIZE( 0 )
CALL RANDOM_SEED (PUT = SEED (1 : K))
! Transfer seed to current generator
CALL RANDOM_SEED (GET = OLD (1 : K))
! Transfer seed from current generator