Manual Reference Pages  - random_init (3fortran)

NAME

RANDOM_INIT(3) - [MATHEMATICS:RANDOM] Initializes the state of the pseudorandom number generator

SYNOPSIS

call random_init(repeatable, image_distinct)

         logical,intent(in) :: repeatable
         logical,intent(in) :: image_distinct

CHARACTERISTICS

o HARVEST and IMAGE_DISTINCT are logical scalars
Description

Initializes the state of the pseudorandom number generator used by RANDOM_NUMBER.

OPTIONS

REPEATABLE : If it is .TRUE., the seed is set to a processor-dependent value that is the same each time RANDOM_INIT is called from the same image. The term "same image" means a single instance of program execution. The sequence of random numbers is different for repeated execution of the program.

If it is .FALSE., the seed is set to a processor-dependent value.

IMAGE_DISTINCT : If is .true., the seed is set to a processor-dependent value that is distinct from the seed set by a call to RANDOM_INITin another image. If it is .FALSE., the seed is set value that does depend which image called RANDOM_INIT.

EXAMPLES

Sample program:

        program demo_random_init
        implicit none
        real x(3), y(3)
           call random_init(.true., .true.)
           call random_number(x)
           call random_init(.true., .true.)
           call random_number(y)
           ! x and y should be the same sequence
           if ( any(x /= y) ) stop "x(:) and y(:) are not all equal"
        end program demo_random_init

STANDARD

Fortran 2018

SEE ALSO

random_number, random_seed

_fortran-lang intrinsic descriptions


Nemo Release 3.1 random_init (3fortran) April 28, 2024
Generated by manServer 1.08 from 2e0f560a-9237-4522-b599-7f29d5d46e73 using man macros.