VMS Help
CRTL, setstate
*Conan The Librarian
|
Restarts and changes random-number generators.
Format
char *setstate (char *state;)
state
Points to the array of state information.
The setstate function handles restarting and changing random-
number generators.
Once you initialize a state, the setstate function allows rapid
switching between state arrays. The array defined by state is
used for further random-number generation until the initstate
function is called or the setstate function is called again. The
setstate function returns a pointer to the previous state array.
After initialization, you can restart a state array at a
different point in one of two ways:
o Use the initstate function, with the desired seed, state
array, and size of the array.
o Use the setstate function, with the desired state, followed by
the srandom function with the desired seed. The advantage of
using both functions is that you do not have to save the state
array size once you initialize it.
See also initstate, srandom, and random.
x A pointer to the previous state array
information.
0 Indicates an error. The state information is
damaged, and errno is set to the following
value:
o EINVAL-The state argument is invalid.