srand [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
srand
Sets a starting point for subsequent calls to rand().
Syntax
#include <stdlib.h>
void srand (unsigned int seed);
Parameters
seed A value that sets the starting point for subsequent calls
to the rand function.
Return Values
None.
Description
The srand function causes subsequent calls to rand() to return a new
random sequence based on the value passed in seed. The sequence of
pseudo-random numbers that rand() produces is always the same for any
given seed. Thus, given seed n, the random sequence is always the same.
If srand() is not used to initialize the random number generator to a
particular starting point, rand() returns the same sequence of numbers as
when srand() is first called with a seed value of one.
See Also
rand(), ANSI C 4.10.2.2, POSIX.1 8.1
MPE/iX 5.0 Documentation