Right, so rand() and srand() does something like this (it is not necessarily how it does it in detail, but the PRINCIPLE applies - the actual code may be a bit more complicated):
So if seed is the same value, then the random numbers will be the same ones every time.Code:static seed = largeNumber0; int rand() { seed = seed * largenumber1 + largenumber2; return seed % MAX_RAND; } void srand(int x) { seed = x; }
The large numbers are almost always prime numbers or pseudo-primes (that is "nearly primes").
In fact, the SEQUENCE of numbers you get out of rand() will ALWAYS be the same, it's just where in the [hopefully pretty long] sequence you start that will change by modifying the seed.
--
Mats