random_number

Date:

02-06-2023

NAME

RANDOM_NUMBER - Returns pseudorandom numbers

SYNOPSIS

CALL RANDOM_NUMBER ([HARVEST=]harvest)
REAL :: harvest

STANDARDS

Fortran

DESCRIPTION

The RANDOM_NUMBER intrinsic subroutine returns one pseudorandom number or an array of pseudorandom numbers from the uniform distribution over the range 0 <= x < 1. It accepts the following argument:

harvest

Must be of type REAL. It is an output argument. It may be a scalar or an array variable. It is set to contain pseudorandom numbers from the uniform distribution in the interval 0 <= x < 1.

The name of this intrinsic cannot be passed as an argument.

EXAMPLES

REAL  X,  Y(10,10)

! Initialize X with a pseudorandom number
CALL RANDOM_NUMBER(HARVEST=X)
CALL RANDOM_NUMBER(Y)

! X and Y contain uniformly distributed random numbers

SEE ALSO

random_seed(3i), ran(3i)