Skip to main content

map32_to_32

Function map32_to_32 

Source
pub fn map32_to_32(hash: u32, n: u32) -> u32
Expand description

Maps 32-bit hash to the range [0, n), where n is a 32-bit integer.

Uses the algorithm described in: Daniel Lemire, A fast alternative to the modulo reduction, https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/