TL;DR
This paper presents a fast, division-free algorithm for generating unbiased random integers in an interval, significantly improving performance in applications like random shuffling, and has been adopted by the Go language.
Contribution
The paper introduces a novel division-free method for unbiased ranged integer generation, enhancing speed and efficiency in random number generation tasks.
Findings
Algorithm doubles the speed of unbiased random shuffling on x64 processors.
The method avoids costly integer divisions, reducing computational overhead.
Adopted by the Go language for its shuffle function implementation.
Abstract
In simulations, probabilistic algorithms and statistical tests, we often generate random integers in an interval (e.g., [0,s)). For example, random integers in an interval are essential to the Fisher-Yates random shuffle. Consequently, popular languages like Java, Python, C++, Swift and Go include ranged random integer generation functions as part of their runtime libraries. Pseudo-random values are usually generated in words of a fixed number of bits (e.g., 32 bits, 64 bits) using algorithms such as a linear congruential generator. We need functions to convert such random words to random integers in an interval ([0,s)) without introducing statistical biases. The standard functions in programming languages such as Java involve integer divisions. Unfortunately, division instructions are relatively expensive. We review an unbiased function to generate ranged integers from a source of…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
