Re:When random is not actually random enough
by incompatible on Tuesday October 06, 2026 @07:42PM
(#49985792)
Makes you wonder at what point overweighting by about 5×10^-20 is something you'd want to care about.
Re:When random is not actually random enough
by jojobas on Tuesday October 06, 2026 @11:44PM
(#49987867)
Picking that from the noise would take quite a while.
Re:When random is not actually random enough
by pestatije on Wednesday October 07, 2026 @01:03AM
(#49988434)
this is what has always baffled me about statistics...having the opportunity to make things exact, with little effort, it is dismissed just because the small error
Re:When random is not actually random enough
by randomNumber7 on Wednesday October 07, 2026 @03:44AM
(#49989586)
It's basic engineering to do what is necessary for solving a problem. Not more.
Re:When random is not actually random enough
by account42 on Wednesday October 07, 2026 @05:09AM
(#49990169)
Not unless of your definition for "what is neccessary for solving a problem" already includes tolerances for the unforseen.
Re:When random is not actually random enough
by Utilera on Thursday October 08, 2026 @03:03AM
(#50002632)
Probably around the point where the consequences of being wrong are much larger than the bias itself
Re:When random is not actually random enough
by omoikane on Tuesday October 06, 2026 @11:13PM
(#49987640)
> rand() Itself has only 32767 possible values
For MingW maybe (due to MSVCRT). I think most libraries such as glibc have RAND_MAX at 2147483647.
Re:When random is not actually random enough
by gpvos on Wednesday October 07, 2026 @08:33AM
(#49991879)
Using 10 integers was actually a simplification to explain what you're talking about here.
If the basic available function was rand_1_to_10(), modulo-ing its result by 3 would clearly make one result more probable than the others. The same happens with random_u64(); even though the difference is smaller, it can still be significant.
Re:When random is not actually random enough
by hermannj314 on Wednesday October 07, 2026 @09:56AM
(#49992988)
Assuming the code is black box, an outside observer would need no more than a thousand observations before they could definitely say something was off about your rand_1_to_10() mod 3 code (with 95% confidence).
But in the case of the random_u64() mod 10, you would need the heat death of the universe number of samples before that bias would be noticeably distinguishable from random.
Is there an actual example of where that specific case could be significant for anything other than maybe nation-state cryptography?
random_u64() Mod 3 does indeed have a single bucket that is oversized. This overweights one option by about 5×10^-20.
rand() Itself has only 32767 possible values, so it's also common for a bucket to be overweighted depending on the number of buckets.