srand
srand
Defined in header <stdlib.h> | ||
---|---|---|
void srand( unsigned seed ); |
Seeds the pseudo-random number generator used by rand()
with the value seed
.
If rand()
is used before any calls to srand()
, rand()
behaves as if it was seeded with srand(1)
.
Each time rand()
is seeded with the same seed
, it must produce the same sequence of values.
srand()
is not guaranteed to be thread-safe.