in reply to Math all gone wrong...
Some insight knowledge of how ANSI C generates random numbers on a 32-bit machine:
this_seed = (last_seed * 69069) % 2 ** 32; (equation 1)
this_random_number = this_seed / 2 ** 32; (equation 2)
Every time you call rand, it first generates a new seed according to quation 1, then generates the random number following equation 2.
You can determine the initial seed by calling srand.
This is just how ANSI C does it. Obviously there are other ways.
Want more? Try the following set of equations, which belongs to the same "family" (this is the term we used to group algorithms generating random numbers, as you can see this family is linear) as the above set:
this_seed = (last_seed * 65539) % 2 ** 31; (equation 1)
this_random_number = this_seed / 2 ** 31; (equation 2)