randomSeedSet¶
Initializes a random seed for use in the random number generators.
Synopsis¶
randomSeedSet (seed)
Required Arguments¶
- int
seed
(Input) - The seed of the random number generator. The argument
seed
must be in the range (0, 2147483646). Ifseed
is 0, a value is computed using the system clock; hence, the results of programs using the random number generators will be different at various times.
Description¶
Function randomSeedSet
is used to initialize the seed used in the random
number generators. The form of the generators is as follows:
\[x_i ≡ cx_{i−1} \mod (2^{31} − 1)\]
The value of \(x_0\) is the seed. If the seed is not initialized prior
to invocation of any of the functions for random number generation by
calling randomSeedSet
, the seed is initialized by the system clock. The
seed can be reinitialized to a clock-dependent value by calling
randomSeedSet
with seed
set to 0.
The effect of randomSeedSet
is to set some global values used by the
random number generators. A common use of randomSeedSet
is in
conjunction with function randomSeedGet to restart a
simulation.
Example¶
See function randomSeedGet.