Intel® Fortran Compiler 16.0 User and Reference Guide

SEED

Portability Subroutine: Changes the starting point of the pseudorandom number generator.

Module

USE IFPORT

CALL SEED (iseed)

iseed

(Input) INTEGER(4). Starting point for RANDOM.

SEED uses iseed to establish the starting point of the pseudorandom number generator. A given seed always produces the same sequence of values from RANDOM.

If SEED is not called before the first call to RANDOM, RANDOM always begins with a seed value of one. If a program must have a different pseudorandom sequence each time it runs, pass the constant RND$TIMESEED (defined in IFPORT.F90) to the SEED routine before the first call to RANDOM.

This routine is not thread-safe.

Example

 USE IFPORT
 REAL myrand
 CALL SEED(7531)
 CALL RANDOM(myrand)

See Also