Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public class Xorshift {
  2. long a;
  3. long b;
  4. long c;
  5. long y;
  6. public Xorshift(long _a, long _b, long _c, long seed) {
  7. this.a = _a;
  8. this.b = _b;
  9. this.c = _c;
  10. this.y = seed;
  11. }
  12. public long next() {
  13. this.y ^= (this.y << this.a) % 4294967296L;
  14. this.y ^= (this.y >> this.b) % 4294967296L;
  15. this.y ^= (this.y << this.c) % 4294967296L;
  16. //System.out.println(this.y);
  17. return y;
  18. }
  19. public void seed(long seed) {
  20. this.y = seed;
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement