skip to main content
article

On the xorshift random number generators

Published: 01 October 2005 Publication History

Abstract

G. Marsaglia recently introduced a class of very fast xorshift random number generators, whose implementation uses three “xorshift” operations. They belong to a large family of generators based on linear recurrences modulo 2, which also includes shift-register generators, the Mersenne twister, and several others. In this article, we analyze the theoretical properties of xorshift generators, search for the best ones with respect to the equidistribution criterion, and test them empirically. We find that the vast majority of xorshift generators with only three xorshift operations, including those having good equidistribution, fail several simple statistical tests. We also discuss generators with more than three xorshifts.

References

[1]
Brent, R. P. 2004a. Note on Marsaglia's xorshift random number generators. J. Stat. Soft. 11, 5, 1--4. See http://www.jstatsoft.org/v11/i05/brent.pdf.
[2]
Brent, R. P. 2004b. Some uniform and normal random number generators. http://web.comlab.ox.ac.uk/oucl/work/richard.brent/random.html.
[3]
Fushimi, M. and Tezuka, S. 1983. The k-distribution of generalized feedback shift register pseudorandom numbers. Comm. ACM 26, 7, 516--523.
[4]
Knuth, D. E. 1998. The Art of Computer Programming, Volume 2: Seminumerical Algorithms, Third ed. Addison-Wesley, Reading, Mass.
[5]
L'Ecuyer, P. 1996. Maximally equidistributed combined Tausworthe generators. Mathematics of Computation 65, 213, 203--213.
[6]
L'Ecuyer, P. 2004. Random number generation. In Handbook of Computational Statistics, J. E. Gentle, W. Haerdle, and Y. Mori, Eds. Springer-Verlag, Berlin, 35--70. Chapter II.2.
[7]
L'Ecuyer, P. and Granger-Piché, J. 2003. Combined generators with components from different families. Mathematics and Computers in Simulation 62, 395--404.
[8]
L'Ecuyer, P. and Simard, R. 1999. Beware of linear congruential generators with multipliers of the form a = ± 2q ± 2r. ACM Trans. Math. Soft. 25, 3, 367--374.
[9]
L'Ecuyer, P. and Simard, R. 2001a. On the performance of birthday spacings tests for certain families of random number generators. Mathematics and Computers in Simulation 55, 1--3, 131--137.
[10]
L'Ecuyer, P. and Simard, R. 2001b. TestU01: A software library in ANSI C for empirical testing of random number generators. Software User's Guide. Available at: http://www.iro.umontreal.ca/~lecuyer.
[11]
Lidl, R. and Niederreiter, H. 1994. Introduction to Finite Fields and Their Applications, Revised Ed. Cambridge University Press, Cambridge.
[12]
Marsaglia, G. 1985. A current view of random number generators. In Computer Science and Statistics, Sixteenth Symposium on the Interface. Elsevier Science Publishers, North-Holland, Amsterdam, 3--10.
[13]
Marsaglia, G. 2003. Xorshift RNGs. J. Stat. Soft. 8, 14, 1--6. See http://www.jstatsoft.org/v08/i14/xorshift.pdf.
[14]
Matousěk, J. 1998. On the L2-discrepancy for anchored boxes. J. Complexity 14, 527--556.
[15]
Matsumoto, M. and Kurita, Y. 1992. Twisted GFSR generators. ACM Trans. Model. Comput. Simul. 2, 3, 179--194.
[16]
Matsumoto, M. and Kurita, Y. 1994. Twisted GFSR generators II. ACM Trans. Model. Comput. Simul. 4, 3, 254--266.
[17]
Matsumoto, M. and Nishimura, T. 1998. Mersenne twister: A 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Trans. Model. Comput. Simul. 8, 1, 3--30.
[18]
Niederreiter, H. 1992. Random Number Generation and Quasi-Monte Carlo Methods. SIAM CBMS-NSF Regional Conference Series in Applied Mathematics, vol. 63. SIAM, Philadelphia.
[19]
Niederreiter, H. 1995. The multiple-recursive matrix method for pseudorandom number generation. Finite Fields and their Applications 1, 3--30.
[20]
Owen, A. B. 1997. Monte Carlo variance of scrambled equidistribution quadrature. SIAM J. Numer. Anal. 34, 5, 1884--1910.
[21]
Panneton, F. 2004. Construction d'ensembles de points basée sur des récurrences linéaires dans un corps fini de caractéristique 2 pour la simulation Monte Carlo et l'intégration quasi-Monte Carlo. Ph.D. thesis, Département d'informatique et de recherche opérationnelle, Université de Montréal, Canada.
[22]
Panneton, F. and L'Ecuyer, P. 2004. Improved long-period generators based on linear recurrences modulo 2. Manuscript.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Modeling and Computer Simulation
ACM Transactions on Modeling and Computer Simulation  Volume 15, Issue 4
October 2005
97 pages
ISSN:1049-3301
EISSN:1558-1195
DOI:10.1145/1113316
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 October 2005
Published in TOMACS Volume 15, Issue 4

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Random number generation
  2. linear feedback shift register
  3. linear recurrence modulo 2
  4. xorshift

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)35
  • Downloads (Last 6 weeks)2
Reflects downloads up to 23 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media