random_seed

Date:

02-06-2023

NAME

RANDOM_SEED - Restarts or queries the pseudorandom number generator

SYNOPSIS

CALL RANDOM_SEED ([[SIZE=]size][,[PUT=]put] [,GET=]get])

INTEGER :: size,put,get

STANDARDS

Fortran

DESCRIPTION

The RANDOM_SEED intrinsic subroutine restarts or queries the pseudorandom number generator used by RANDOM_NUMBER. It accepts the following arguments (note that there must be exactly one argument or no arguments present):

size

Must be scalar and of type integer. It is an output argument. It is set to the number N of integers that the processor uses to hold the value of the seed.

put

Must be an integer array of rank one and size >= N. It is an input argument. It is used to set the seed value.

get

Must be an integer array of rank one and size >= N. It is an output argument. It is set to the current value of the seed.

“If no argument is present, the seed is assigned a processor-dependent value.

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

EXAMPLES

CALL RANDOM_SEED                          ! initialization of seed
CALL RANDOM_SEED(SIZE = K)                ! Sets K = N
CALL RANDOM_SEED(PUT = SEEDARRAY(1:K))    ! Set user seed
CALL RANDOM_SEED(GET = OLDSEED(1:K))      ! Get current seed

SEE ALSO

random_number(3i)