3 ms·
Doesn't matter what your RAND_MAX is if you're taking the result modulo anything that's not a power of two.
by clarry 12y ago
Doesn't matter what your RAND_MAX is if you're taking the result modulo anything that's not a power of two.
- conistonwater 12y agoNo, 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.
- christianmann 12y agoAnd if you have a need for it to be precisely correct, I have bad news for you about the word "random".
- clarry 12y agoI have no idea what I was thinking, but I stand corrected. Thanks.