Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

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)