Aside from the range being 390, it shouldn't make any difference. In my test-case it works just fine.
What sequence are you getting?
--
Mats
Printable View
For that range, I tried that code generating 1000 numbers instead of just 25 and got 17 repeats... 100 numbers and I got 1 repeat... 25 numbers (run 5 times) and not a single repeat any of those times.
Hey,
I've also been doing some tests on it and I wonder if anyone could speak to something I noticed:
If I had the program generate only 1 random number, and then I ran that program a few times, there was a higher incidence of repeating than if I had the program generate several random numbers all in one go. Does this make sense given the algorithm?
Thanks.
Sure, it makes sense given that the change in the original seed given to srand() is "similar", which leads to a more likely incidence of the same number [if time is measured in seconds, then two calls within the same second will give the same seed -> same random number].
--
Mats
gotcha. makes sense. thanks.