The random number generator supplied as the intrinsic subroutine
RANDOM_NUMBER
is the “Mersenne Twister”.
Note that this generator has a large state (630 32-bit integers) and an
extremely long period
(approx 106000),
and therefore it is
strongly recommended that the RANDOM_SEED
routine only be used with
a PUT
argument that is the
value returned by a previous call with GET
; i.e., only to repeat a
previous sequence.
This is because if a user-specified seed has low entropy (likely since there
are 630 values to be supplied), it is highly likely to set the generator to an
apparently-low-entropy part of the sequence.
If you do want to provide your own seed (and thus entropy), you should store your values in the initial elements of the seed array and set all the remaining elements to zero — trailing zero elements will be ignored and not used to initialise the generator. Note that the seed is a random bitstream, and is therefore expected to have approximately half of its bits nonzero (thus providing many small integer values will likely result in a low-entropy part of the Mersenne Twister sequence being reached).
With the -random=7.2 option (default), two 32-bit elements of the Mersenne Twister sequence are used for each double precision number, and four for each quad precision number. With the -random=5.2 option, only one element is used for a double precision number, and two for a quad precision number; this provides increased performance, but with reduced entropy in the low-order bits of each value.