-
December 22nd, 2009, 01:56 AM
#1
[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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|