Files
bind9/lib/isc/include/isc
Tony Finch d20ea4a703 Make isc_random_uniform() nearly divisionless
It used to require two 32-bit integer divisions to get a random number
less than some limit. Now we use Daniel Lemire's "nearly-divisionless"
algorithm for unbiased bounded random numbers, which requires one
64-bit integer multiply in the usual case, and one 32-bit integer
division in rare slow cases. Even the slow cases are faster than
before; there are also fewer branches.

I think this algorithm is exceptionally beautiful. It also has more
clever tricks than lines of code, so I have done my best to explain
how it works.
2022-04-22 16:40:37 +01:00
..
2022-03-28 15:02:18 -07:00
2022-01-27 15:48:50 -08:00
2022-01-27 13:02:23 +01:00
2022-01-27 15:48:50 -08:00
2022-04-06 18:45:57 +03:00
2022-04-04 21:20:05 +02:00