Visible to Intel only — GUID: GUID-5AC7231D-7C8F-4A2A-A143-25A08E013D03
Visible to Intel only — GUID: GUID-5AC7231D-7C8F-4A2A-A143-25A08E013D03
RANDOM_INIT
Intrinsic Subroutine: Initializes the pseudorandom number generator used by RANDOM_NUMBER.
CALL RANDOM_INIT (repeatable, image_distinct)
repeatable |
(Input) Must be scalar of type logical. |
image_distinct |
(Input) Must be scalar of type logical. |
If repeatable has the value .true. and image_distinct has the value .true., the effect of a call to RANDOM_INIT is equivalent to calling RANDOM_SEED with a different processor-dependent value of PUT on each image that executes the call. If the invoking image index on the initial team is the same, the value of PUT is the same each time the program is executed.
If repeatable has the value .true. and image_distinct has the value .false., the effect of a call to RANDOM_INIT is equivalent to calling RANDOM_SEED with the same processor-dependent value of PUT on each image that executes the call. If the invoking image index on the initial team is the same, the value of PUT is the same each time the program is executed.
If repeatable has the value .false. and image_distinct has the value .true., the effect of a call to RANDOM_INIT is equivalent to calling RANDOM_SEED with a different processor-dependent value of PUT on each image that executes the call. If the invoking image index on the initial team is the same, the value of PUT is different each time the program is executed.
If repeatable has the value .false. and image_distinct has the value .false., the effect of a call to RANDOM_INIT is equivalent to calling RANDOM_SEED with the same processor-dependent value of PUT on each image that executes the call. If the invoking image index on the initial team is the same, the value of PUT is the different each time the program is executed.
This routine is thread safe.
Example
Consider the following:
PROGRAM main
REAL,DIMENSION(1000) :: y
CALL RANDOM_INIT (REPEATABLE=.TRUE., IMAGE_DISTINCT=.TRUE.)
CALL RANDOM_NUMBER (y)
. . .
END
After executing the above code, the array y contains a different sequence of pseudorandom numbers on each image that executes the code. If the program is executed multiple times, for an image that has the same image index in the initial team, the value of y is the same each time the program is run.
Consider another example:
PROGRAM main
REAL,DIMENSION(1000) :: y
CALL RANDOM_INIT (REPEATABLE=.FALSE., IMAGE_DISTINCT=.FALSE.)
CALL RANDOM_NUMBER (y)
. . .
END
After executing the above code, the array y contains the same sequence of pseudorandom numbers on each image that executes the code. If the program is executed multiple times, the value of y is different each time the program is run.