Xoroshiro128+
xoroshiro128+ (XOR/rotate/shift/rotate) is a successor to Xorshift (implementation at xorshift128+). Instead of perpetuating Marsaglia's tradition of xorshift as a basic operation, xoroshiro128+ uses a carefully handcrafted shift/rotate-based linear transformation designed 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. xoroshiro128+ is our current suggestion for replacing low-quality generators commonly found in programming languages. [1]
Even though created in 2016, there are already several xoroshiro128+ Implementations. If this Pseudo-Random Number Generator (PNRG) is as fast and quality as they say, it should become the new standard, although the period of repetition (2128-1) is not long enough for massively parallel use, according to Vigna. [2]
Implementations
- Java Implementation
- Clojure implementation
- Swift implementation in this file and comparison with other RNG's here: "Random number generators in Swift".
Quotes
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."[3]
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.[4]
See Also
References
- ↑ Vigna, Sebastiano (2016). "xoroshiro+ / xorshift* / xorshift+ Generators and The PRNG Shootout". vigna.di.unimi.it. David Blackman and Sebastiano Vigna (vigna[at]acm[dot]org). Retrieved November 2, 2016.
- ↑ Xoroshiro128+ Public Domain released source code. Written in 2016 by David Blackman and Sebastiano Vigna (vigna[at]acm[dot]org)
- ↑ Meister, David (August 1, 2016). "Clojure implementation of the xoroshiro128+ PRNG described at web site xoroshiro.di.unimi.it". github.com. Retrieved November 2, 2016.
- ↑ Gallagher, Matt (May 19, 2016). "Random number generators in Swift". www.cocoawithlove.com. Retrieved November 2, 2016.