Daniel Lemire personal blog

A fast alternative to the modulo reduction (2016)

Suppose you want to pick an integer at random in a set of N elements. Your computer has functions to generate random 32-bit integers, how do you transform such numbers into indexes no larger than N? Suppose you have a hash table with a capacity N. Again, you need to transform your hash values (typically 32-bit ……
Points
114
HN comments
68
Submissions
2
Cited by
13 commenters

Math & AlgorithmsSystems & Performance2019

On Hacker News

SubmittedTitle on HNPointsComments
Oct 6, 2019A fast alternative to the modulo reduction (2016) by bra-ket11435
Aug 16, 2021A fast alternative to the modulo reduction (2016) by karmakaze6333

Cited in comments

Linked from 13 Hacker News comments by 13 different people, from Feb 2017 to Feb 2026.

Most recent:

Search every comment that links here →

More from Daniel Lemire

All 87 posts →

Related posts from the same era