RANDOM_SEED — Initialize a pseudo-random number sequence#
-
RANDOM_SEED(SIZE, PUT, GET)#
Restarts or queries the state of the pseudorandom number generator used by
RANDOM_NUMBER.- Parameters
SIZE – (Optional) Shall be a scalar and of type default
INTEGER, withINTENT(OUT). It specifies the minimum size of the arrays used with thePUTandGETarguments.PUT – (Optional) Shall be an array of type default
INTEGERand rank one. It isINTENT(IN)and the size of the array must be larger than or equal to the number returned by theSIZEargument.GET – (Optional) Shall be an array of type default
INTEGERand rank one. It isINTENT(OUT)and the size of the array must be larger than or equal to the number returned by theSIZEargument.
- Standard:
Fortran 90 and later
- Class:
Subroutine
- Syntax:
CALL RANDOM_SEED([SIZE, PUT, GET])
- Example:
program test_random_seed implicit none integer, allocatable :: seed(:) integer :: n call random_seed(size = n) allocate(seed(n)) call random_seed(get=seed) write (*, *) seed end program test_random_seed
- See also:
RANDOM_NUMBER — Pseudo-random number, RANDOM_INIT — Initialize a pseudo-random number generator