random_seed_set
Initializes a random seed for use in the IMSL random number generators.
Synopsis
#include <imsl.h>
void imsl_random_seed_set (int seed)
Required Arguments
int seed (Input)
The seed of the random number generator. The argument seed must be in the range (0, 2147483646). If seed is zero, a value is computed using the system clock. Hence, the results of programs using the IMSL random number generators will be different at various times.
Description
The function imsl_random_seed_set is used to initialize the seed used in the IMSL random number generators. The form of the generators is
xi ≡ cxi-1 mod (231 − 1)
The value of x0 is the seed. If the seed is not initialized prior to invocation of any of the routines for random number generation by calling imsl_random_seed_set, the seed is initialized via the system clock. The seed can be reinitialized to a clock-dependent value by calling imsl_random_seed_set with seed set to 0.
The effect of imsl_random_seed_set is to set some global values used by the random number generators.
A common use of
imsl_random_seed_set is in conjunction with
imsl_random_seed_get to restart a simulation.
Example