SYNOPSIS<srand $seed>
DESCRIPTION
The srand
function "seeds" the pseudo-random number
generator with an integer $seed
, which determines what sequence
of pseudo-random numbers will be returned in future calls to
rand
and randpick
. This can be used to help ensure the
sequence is different each run (with a random seed), or to generate
the same sequence on a subsequent run (with the same seed) i.e. for
reproducibly random results.
If an empty string is given, a semi-random seed is created; this is
also how the generator is seeded if srand
is not called.
DIAGNOSTICS
The srand
function returns the previous seed value.
EXAMPLE<srand 12345>
<WHILE $loop lt 10>
<rand 0 10> $ret
</WHILE>
The output will always produce the same sequence of "random" numbers on a given platform.
CAVEATS
The srand
function was added Mar. 16 2000.
The reproducibility and/or randomness of numbers is system-dependent.