Xorshift

From Wikipedia, the free encyclopedia

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

  1. ^ [computer-go] 10k UCT bots

[edit] External links

  • Xorshift RNGs - The paper by George Marsaglia that proposes them.