December 22nd, 2009, 12:56 AM
[RESOLVED] Random number generation
I am trying to generate random numbers between 10 and 20. I have used srand(time(0)) and called it once before the for loop. As the program program run faster, the for loop is probably getting same seed. To overcome, I used sleep(1000) for every iteration the rand() is called. I am not expecting all unique values, as it should not be, but I get 1 sec delay. Is there any better approach ? Thank you for reading.
Tags for this Thread
Click Here to Expand Forum to Full Width