Common mistake. Never call srand() more than once in a program. Just stick it at the top of main(), and don't call it anywhere else.