Fast Random Integer Generation in an Interval

@article{Lemire2019FastRI,
  title={Fast Random Integer Generation in an Interval},
  author={Daniel Lemire},
  journal={ACM Transactions on Modeling and Computer Simulation (TOMACS)},
  year={2019},
  volume={29},
  pages={1 - 12}
}
  • D. Lemire
  • Published 28 May 2018
  • Computer Science, Mathematics
  • ACM Transactions on Modeling and Computer Simulation (TOMACS)
In simulations, probabilistic algorithms, and statistical tests, we often generate random integers in an interval (e.g., [0,s. [] Key Method We review an unbiased function to generate ranged integers from a source of random words that avoids integer divisions with high probability. To establish the practical usefulness of the approach, we show that this algorithm can multiply the speed of unbiased random shuffling on x64 processors. Our proposed approach has been adopted by the Go language for its…

Figures and Tables from this paper

Replicated Computational Results (RCR) Report for “Fast Random Integer Generation in an Interval”
  • F. Quaglia
  • Computer Science
    ACM Trans. Model. Comput. Simul.
  • 2019
TLDR
The approach taken by the author is the one of exploiting the rejection method to build an algorithm that almost eliminates the need for performing integer division operations, and its implementation for x86 processors is compared with solutions offered by common software libraries for different programming languages.
Randen - fast backtracking-resistant random generator with AES+Feistel+Reverie
TLDR
This work introduces a new open-sourced generator called Randen, an instantiation of Reverie, a recently published robust sponge-like random generator, with a new permutation built from an improved generalized Feistel structure with 16 branches, which can protect randomized algorithms such as reservoir sampling from attack.
Drawing Random Floating-point Numbers from an Interval
  • F. Goualard
  • Computer Science
    ACM Transactions on Modeling and Computer Simulation
  • 2022
TLDR
This work investigates and quantify precisely the shortcomings of floating-point arithmetic's location-scale transformation while reviewing the actual implementations of the method in major programming languages and libraries, and proposes a simple algorithm to avoid these shortcomings without compromising performances.
Ribbon filter: practically smaller than Bloom and Xor
TLDR
The Ribbon filter is introduced: a new filter for static sets with a broad range of configurable space overheads and false positive rates with competitive speed over that range, especially for larger f ≥ 2−7.
Engineering Uniform Sampling of Graphs with a Prescribed Power-law Degree Sequence
TLDR
This work sketches Inc-Powerlaw, a novel and much more involved algorithm capable of generating graphs for power-law bounded degree sequences with γ ' 2.88 in expected linear time and is the first practical generator with rigorous uniformity guarantees for the aforementioned degree sequences.
Differential Evolution under Fixed Point Arithmetic and FP16 Numbers
In this work, the differential evolution algorithm behavior under a fixed point arithmetic is analyzed also using half-precision floating point (FP) numbers of 16 bits, and these last numbers are
Parallel Global Edge Switching for the Uniform Sampling of Simple Graphs with Prescribed Degrees
TLDR
This work engineer a simple sequential ES-MC implementation representing the graph in a hash-set and proposes the Global Edge Switching Markov Chain (G-ES-MC) and shows that it converges to a uniform distribution.
Hash Tables with Pseudorandom Global Order
TLDR
The idea is to use the numerical order given by a hashing function and resolve collisions upholding said order by using bubble sort on the small patches that inevitably form.
Gaussian Distributed Noise Generator Design Using MCU-STM32
TLDR
The implementation of the Gaussian distributed pseudo noise generation algorithm based on the Enhanced Box-Muller method, which can be applied to the MCU-STM32F4 efficiently, producing signal noise with Gaussian distribution is described.
...
...

References

SHOWING 1-10 OF 49 REFERENCES
Engineering Parallel In-Place Random Generation of Integer Permutations
TLDR
This work tackles the feasibility and efficiency of two new parallel algorithms that sample random permutations of the integers [M] = {1, ..., M} and shows high scalability and outperforms the previously known approaches by far.
Random Number Generation
  • P. L’Ecuyer
  • Computer Science, Mathematics
    Encyclopedia of Algorithms
  • 2008
TLDR
The main goal is to reproduce the statistical properties on which these methods are based, so that the Monte Carlo estimators behave as expected, whereas for gambling machines and cryptology, observing the sequence of output values for some time should provide no practical advantage for predicting the forthcoming numbers better than by just guessing at random.
Romu: Fast Nonlinear Pseudo-Random Number Generators Providing High Quality
TLDR
The Romu family of pseudo-random number generators (PRNGs) which combines the nonlinear operation of rotation with the linear operations of multiplication and (optionally) addition achieves a greater degree of randomness using the same number of arithmetic operations, resulting in higher speed.
TestU01: A C library for empirical testing of random number generators
We introduce TestU01, a software library implemented in the ANSI C language, and offering a collection of utilities for the empirical statistical testing of uniform random number generators (RNGs).
Random numbers for simulation
TLDR
This paper focuses mainly on efficient and recently proposed techniques for generating uniform pseudorandom numbers, and aims to design more robust generators without having to pay too much in terms of portability, flexibility, and efficiency.
Generating Random Permutations by Coin Tossing
TLDR
Several simple, classical, little-known algorithms for generating random permutations by coin tossing are examined, analyzed, and implemented, and asymptotically optimal approximations to the expected complexity are made.
History of uniform random number generation
  • P. L’Ecuyer
  • Computer Science
    2017 Winter Simulation Conference (WSC)
  • 2017
TLDR
A historical account on the design, implementation, and testing of uniform random number generators used for simulation is given.
Random Permutations on Distributed, External and Hierarchical Memory
A search for good multiple recursive random number generators
TLDR
An extensive computer search for good multiple recursive generators, in terms of their lattice structure and implementation speed, finds generators that are a little slower than the usual linear congruential generators, but have much longer periods and much better statistical properties.
Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator
TLDR
A new algorithm called Mersenne Twister (MT) is proposed for generating uniform pseudorandom numbers, which provides a super astronomical period of 2 and 623-dimensional equidistribution up to 32-bit accuracy, while using a working area of only 624 words.
...
...