|
|
#include <stdlib.h>void srand(unsigned int seed);
The srand( ) function sets a starting point for the sequence generated by rand( ). (The rand( ) function returns pseudorandom numbers.)
srand( ) is often used to allow multiple program runs to use different sequences of pseudorandom numbers by specifying different starting points. Conversely, you can also use srand( ) to generate the same pseudorandom sequence over and over again by calling it with the same seed before starting the sequence.
A related function is rand( ).
|
|