Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
gotcha. makes sense. thanks.