rand() will produce the same sequence every time unless you give it a seed. There is no such thing ... well at least in code ... as a magical source of perfect randomness. rand() is an algorithm that generates a seemingly random number from the previous number (the seed). If you give srand() the same seed, it will cause rand() to always generate the same sequence.
One way that people use to start the seed is to take the seed from the current time:
srand( time(0) );
I believe that's how it goes. You use srand() at the start of your program, once. You should NOT use srand() every time since time(0) only changes once per second, and even when it does it changes only the lower bits, which will give you very similar seeds.