Figure 3. Description of the srand function.
|void srand ( unsigned int seed );
Initialize random number generator
The pseudo-random number generator is initialized using the argument passed as seed.
Two different initializations with the same seed, instructs the pseudo-random generator to generate the same succession of results for the subsequent calls to rand in both cases.
In order to generate random-like numbers, srand is usually initialized to some distinctive value, like those related with the execution time. For example, the value returned by the function time (declared in header <ctime>) is different each second, which is distinctive enough for most randoming needs.