Initializes random number generators.
#include <stdlib.h> char *initstate (unsigned int seed, char *state, int size);
Values for the amount of state information are 8, 32, 64, 128, and 256 bytes. Amounts less than 8 bytes generate an error, while other amounts are rounded down to the nearest known value.
The seed argument specifies a starting point for the random number sequence and provides for restarting at the same point. The initstate function returns a pointer to the previous state information array.
Once you initialize a state, the setstate function allows rapid switching between states. The array defined by the state argument 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:
See also setstate, and srandom, in this section.
x | A pointer to the previous state array information. |
0 | Indicates an error. Call made with less than 8 bytes of state information. Further specified in the global errno. |