Re:Random in the wild
by clarry on Tuesday December 09, 2014 @03:46PM
(#8725599)
Doesn't matter what your RAND_MAX is if you're taking the result modulo anything that's not a power of two.
[ Parent
| on HN ]
Re:Random in the wild
by conistonwater on Tuesday December 09, 2014 @03:57PM
(#8725675)
No, it does matter. If RAND_MAX is really large, the relative error in "incorrect" probabilities is really small. Unless you have a critical need for it to be precisely correct, the error is basically negligible.
I have no idea what I was thinking, but I stand corrected. Thanks.
Re:Random in the wild
by christianmann on Wednesday December 10, 2014 @02:22AM
(#8728071)
And if you have a need for it to be precisely correct, I have bad news for you about the word "random".