Xorshift
From Wikipedia, the free encyclopedia
Please help improve this article or section by expanding it. Further information might be found on the talk page or at requests for expansion. (April 2008) |
This article needs additional citations for verification. Please help improve this article by adding reliable references. Unsourced material may be challenged and removed. (April 2008) |
Xorshift is a category of pseudorandom number generators designed by George Marsaglia. It repeatedly uses the transform of exclusive or on a number with a bit shifted version of it.
A C version of this algorithm is:[1]
unsigned long xorshiftrand(void) { static unsigned long x=123456789, y=362436069, z=521288629, w=88675123; unsigned long t; t = x ^ (x << 11); x = y; y = z; z = w; return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); }
[edit] References
[edit] External links
- Xorshift RNGs - The paper by George Marsaglia that proposes them.