+ 5
Computers are deterministic machines, and therefore have some major trouble with generating random numbers. You give it an algorithm and it's going to run it the same every time, because that's what computers do.
So how do we get random numbers, then? One way is to provide an input to the randomization procedure-- That's what a "seed" is. If your seed is reasonably unpredictable, you'll have the illusion of randomness.
srand is what allows you to specify a seed. You usually only need to specify a seed once, even though you can call rand() as often as you wish. A quick and easy seed value to use is the current time:
srand(time(NULL));