Next: , Previous: , Up: Intrinsic Procedures   [Contents][Index]


9.222 RANDOM_NUMBER — Pseudo-random number

Description:

Returns a single pseudorandom number or an array of pseudorandom numbers from the uniform distribution over the range 0 \leq x < 1.

The runtime-library implements the xorshift1024* random number generator (RNG). This generator has a period of 2^{1024} - 1, and when using multiple threads up to 2^{512} threads can each generate 2^{512} random numbers before any aliasing occurs.

Note that in a multi-threaded program (e.g. using OpenMP directives), each thread will have its own random number state. For details of the seeding procedure, see the documentation for the RANDOM_SEED intrinsic.

Standard:

Fortran 95 and later

Class:

Subroutine

Syntax:

RANDOM_NUMBER(HARVEST)

Arguments:
HARVESTShall be a scalar or an array of type REAL.
Example:
program test_random_number
  REAL :: r(5,5)
  CALL RANDOM_NUMBER(r)
end program
See also:

RANDOM_SEED