Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
/ xorshift Public archive
forked from WebDrake/xorshift

Reference implementations of Xorshift RNGs taken from George Marsaglia's 2003 paper.

Notifications You must be signed in to change notification settings

msikma/xorshift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Xorshift RNG reference code

The Xorshift family of random number generators were introduced by George Marsaglia in 2003 in a paper published in the Journal of Statistical Software:

This repository contains a working copy of the reference code provided by Marsiglia in his paper, tweaked very slightly as follows:

  • Marsaglia's paper uses unsigned long as the word type, which may be either 32- or 64-bit depending on the implementation. This has been changed to uint32_t to ensure the word type is an unsigned 32-bit integer.

  • Some small typos in Marsaglia's paper have been corrected. Without these corrections the Xorshift32 and Xorshift160 implementations depart strongly from uniformity. See the git history log for details of these corrections.

In all other respects the xorNNN() functions here reflect Marsaglia's sample code and may thus be useful to verify other implementations.

DISCLAIMER: no claims are made for the suitability of these RNGs for any purpose, certainly not crypto or any mission-critical or security-related applications. Even using them to verify other Xorshift implementations may be dubious, given the observed typos in the original source material. The author thinks he has corrected everything that needs to be corrected, but you should check for yourself. In other words, use this code at your own risk. :-)

Modifications and credits

This code was written by Joe Wakeling and modified slightly by Michiel Sikma. For the original version, see https://github.com/WebDrake/xorshift.

  • Added .h file, removed the main() and renamed xorwow() to xor192().
  • Minor reformatting
  • Added xor32f() functions, etc.

About

Reference implementations of Xorshift RNGs taken from George Marsaglia's 2003 paper.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%