Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Xorshift {
- long a;
- long b;
- long c;
- long y;
- public Xorshift(long _a, long _b, long _c, long seed) {
- this.a = _a;
- this.b = _b;
- this.c = _c;
- this.y = seed;
- }
- public long next() {
- this.y ^= (this.y << this.a) % 4294967296L;
- this.y ^= (this.y >> this.b) % 4294967296L;
- this.y ^= (this.y << this.c) % 4294967296L;
- //System.out.println(this.y);
- return y;
- }
- public void seed(long seed) {
- this.y = seed;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement