Function anchorhash::range_map
source · [−]Expand description
An efficient modulo-like operation mapping v
into the range [0, max)
for
modern 64-bit CPUs.
Algorithm taken from Daniel Lemire’s Fast Random Integer Generation in an Interval
without the rejection method, therefore accepting a bias in the
result.
Benchmarks (included in this crate) showed this implementation to be ~70% faster than the (already very fast) modulo implementation.