RNSET

Initializes a random seed for use in the IMSL random number generators.

Required Arguments

ISEED — The seed of the random number generator. (Input)
ISEED must be in the range (0, 2147483646). If ISEED is zero, a value is computed using the system clock; and, hence, the results of programs using the IMSL random number generators will be different at different times.

FORTRAN 90 Interface

Generic: CALL RNSET (ISEED)

Specific: The specific interface name is RNSET .

FORTRAN 77 Interface

Single: CALL RNSET (ISEED)

Description

Routine RNSET is used to initialize the seed used in the IMSL random number generators. If the seed is not initialized prior to invocation of any of the routines for random number generation by calling RNSET, the seed is initialized via the system clock. The seed can be reinitialized to a
clock-dependent value by calling RNSET with ISEED set to 0.

The effect of RNSET is to set some values in a FORTRAN COMMON block that is used by the random number generators.

A common use of RNSET is in conjunction with RNGET to restart a simulation.

Example

The following FORTRAN statements illustrate the use of RNSET:

 

INTEGER ISEED

! Call RNSET to initialize the seed via the

! system clock.

CALL RNSET(0)

! Do some simulations.

...

...

! Obtain the current value of the seed.

CALL RNGET(ISEED)

! If the simulation is to be continued in a

! different program, ISEED should be output,

! possibly to a file.

...

...

! When the simulations begun above are to be

! restarted, restore ISEED to the value

! obtained above, and use as input to RNSET.

CALL RNSET(ISEED)

! Now continue the simulations.

...

...