Timing...to seed or not to seed (in each iteration)
Should I seed the random generator inside the while loop or only once at the start of program? And why or why not?
++postcount;
Only once. Otherwise you might give it the same seed twice, and get the same result twice where you shouldn''t.
I agree. If you''re using srand(time(NULL)), then since time() changes only once per second, you''ll get the same set of random numbers more than you''d expect.
The only time that you should re-seed the generator is if you really want to generate the same set of numbers again.
The only time that you should re-seed the generator is if you really want to generate the same set of numbers again.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement