RANDOM_NUMBER(HARVEST)

Purpose

Returns one pseudo-random number or an array of pseudo-random numbers from the uniform distribution over the range 0 ≤ x < 1.

If you link the libpthreads.a library, a parallel implementation of random number generation is employed which improves performance on SMP machines. The number of threads used can be controlled by the intrinthds=num run-time option.

Class

Subroutine

Argument type and attributes

HARVEST
An INTENT(OUT) REAL. The actual argument corresponding to HARVEST can be a scalar or an array variable. It is set to pseudo-random numbers from the uniform distribution in the interval 0 ≤ x < 1.

Examples

REAL X, Y (10, 10)
! Initialize X with a pseudo-random number
CALL RANDOM_NUMBER (HARVEST = X)
CALL RANDOM_NUMBER (Y)
! X and Y contain uniformly distributed random numbers