English

Squares: A Fast Counter-Based RNG

Data Structures and Algorithms 2022-03-15 v7

Abstract

In this article, we propose a new counter-based implementation of John von Neumann's middle-square random number generator (RNG). Several rounds of squaring are applied to a counter to produce a random output. We discovered that four rounds are sufficient to provide satisfactory data. Two versions of the RNG are presented, a 4-round version with 32-bit output and a 5-round version with 64-bit output. Both pass stringent tests of randomness and may be the fastest counter-based generators.

Keywords

Cite

@article{arxiv.2004.06278,
  title  = {Squares: A Fast Counter-Based RNG},
  author = {Bernard Widynski},
  journal= {arXiv preprint arXiv:2004.06278},
  year   = {2022}
}

Comments

A software package with example programs is available at http://squaresrng.wixsite.com/rand

R2 v1 2026-06-23T14:50:13.300Z