XOR32.cs 396 B

1234567891011121314151617181920212223242526
  1. using System;
  2. public class XOR32
  3. {
  4. public XOR32(int x_)
  5. {
  6. this.x = (uint)(471283569 + x_);
  7. }
  8. public uint next()
  9. {
  10. uint num = this.x ^ this.x << 11;
  11. this.x = this.y;
  12. this.y = this.z;
  13. this.z = this.w;
  14. return this.w = (this.w ^ this.w >> 19 ^ (num ^ num >> 8));
  15. }
  16. private uint x;
  17. private uint y = 362436069u;
  18. private uint z = 521288629u;
  19. private uint w = 88675123u;
  20. }