You are calling srand() more than once; you don't need to do "srand(rand());" ![]()
The rule of thumb is, call srand() only once for your entire program, and pass it time(0) (which you did), but you are calling srand() every loop.
See this thread for more details.