Manual Reference Pages  - random_seed (3fortran)

NAME

RANDOM_SEED(3) - [MATHEMATICS:RANDOM] Initialize a pseudo-random number sequence

SYNOPSIS

call random_seed( [size] [,put] [,get] )

         subroutine random_seed( size, put, get )

integer,intent(out),optional :: size integer,intent(in),optional :: put(*) integer,intent(out),optional :: get(*)

CHARACTERISTICS

o SIZE a scalar default integer
o PUT a rank-one default integer array
o GET a rank-one default integer array
o the result

DESCRIPTION

RANDOM_SEED(3) restarts or queries the state of the pseudorandom number generator used by random_number.

If random_seed is called without arguments, it is seeded with random data retrieved from the operating system.

OPTIONS

o SIZE : specifies the minimum size of the arrays used with the PUT and GET arguments.
o PUT : the size of the array must be larger than or equal to the number returned by the SIZE argument.
o GET : It is INTENT(OUT) and the size of the array must be larger than or equal to the number returned by the SIZE argument.

EXAMPLES

Sample program:

        program demo_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 demo_random_seed

Results:

     >    -674862499 -1750483360  -183136071  -317862567   682500039
     >    349459   344020729 -1725483289

STANDARD

Fortran 95

SEE ALSO

RANDOM_NUMBER(3)

Fortran intrinsic descriptions


Nemo Release 3.1 random_seed (3fortran) November 02, 2024
Generated by manServer 1.08 from 9ee2d4bd-143c-4a35-9f4f-aac3906aa518 using man macros.