Harman Patil (Editor)

Xoroshiro128

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

xoroshiro128+ (XOR/rotate/shift/rotate) is a successor to Xorshift. Instead of perpetuating Marsaglia's tradition of xorshift as a basic operation, xoroshiro128+ uses a carefully handcrafted shift/rotate-based linear transformation designed by Sebastiano Vigna in collaboration with David Blackman. The result is a significant improvement in speed (well below a nanosecond per integer) and a significant improvement in statistical quality, as detected by the long-range tests of PractRand.

Contents

Quotations

The Clojure implementer made some valuable statements:

"This is a clojure implementation of the xoroshiro128+ PRNG described at http://xoroshiro.di.unimi.it/The algorithm has been shown to be fast and produce superior statistical results to many PRNGs shipped with languages, including Java. The statistical results have been verified in both PractRand and TestU01 by the authors. xoroshiro128+ is designed to be the successor to xorshift128+, currently used in the JavaScript engines of Chrome, Firefox and Safari. Both xorshift128+ and xoroshiro128+ have a period of 2128 but xoroshiro128+ is benchmarked by the authors as 20% faster and with 20% fewer failures in BigCrush than its predecessor."

Matt Gallagher, in his study on random number generators in Swift made the following conclusion:

It looks like Xoroshiro is the best general purpose algorithm currently available. Low memory (just 128 bits of storage), extremely high performance (1.2 nanoseconds per 64-bit number, after subtracting baseline overheads) and very well distributed (beating other algorithms on a range of automated tests). Mersenne Twister might still be a better choice for highly conservative projects unwilling to switch to such a new algorithm, but the current generation of statistically tested algorithms brings a baseline of assurance from the outset that previous generations lacked.

Implementations

  • Original C source code implementation
  • Java Implementation
  • Clojure implementation
  • Swift implementation in this file and comparison with other RNG's here: "Random number generators in Swift".
  • References

    Xoroshiro128+ Wikipedia