Support for various variants of Xorshift pseudo-random generator.
For execution in software, xorshift generators are among the fastest PRNGs, requiring very small code and state. However, they do not pass every statistical test without further refinement. This weakness is amended by combining them with a non-linear function, as described in the original paper. Because plain xorshift generators (without a non-linear step) fail some statistical tests, they have been accused of being unreliable.
— https://en.wikipedia.org/wiki/Xorshift
This PR includes both linear and non-linear variants of the generators. I have also tested them all to work faster than their matching (random) call. The wikipedia page further lists pros and cons of the generator.
Support for various variants of Xorshift pseudo-random generator.
This PR includes both linear and non-linear variants of the generators. I have also tested them all to work faster than their matching
(random)
call. The wikipedia page further lists pros and cons of the generator.Inspired by 2015 article on Math.random(), https://v8.dev/blog/math-random Based on works of George Marsaglia (https://www.jstatsoft.org/article/view/v008i14) and Sebastiano Vigna (https://prng.di.unimi.it/).