[UP]


Manual Reference Pages  - random_seed (3)

NAME

random_seed(3f) - [FORTRAN:INTRINSIC] Initialize a pseudo-random number sequence

CONTENTS

Syntax
Description
Arguments
Example
Standard
Class
See Also

SYNTAX

call random_seed([size, put, get])

DESCRIPTION

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.

ARGUMENTS

SIZE - (Optional) Shall be a scalar and of type default INTEGER, with intent(out). It specifies the minimum size of the arrays used with the PUT and GET arguments.
PUT - (Optional) Shall be an array of type default INTEGER and rank one. It is intent(in) and the size of the array must be larger than or equal to the number returned by the SIZE argument.
GET - (Optional) Shall be an array of type default INTEGER and rank one. It is intent(out) and the size of the array must be larger than or equal to the number returned by the SIZE argument.

EXAMPLE

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

STANDARD

[[Fortran 95]] and later

CLASS

Subroutine

SEE ALSO

[[random_number]]


random_seed (3) March 19, 2019
Generated by manServer 1.08 from 6c1c61a0-38c0-4959-a713-a11ed4432776 using man macros.