xorshift icon indicating copy to clipboard operation
xorshift copied to clipboard

jump and next_u64 don't show same result

Open MyZeD opened this issue 4 years ago • 0 comments

If I define 2 Xorshifts, one with next_u64 and the other with jump, the result is not the same. am I doing something wrong?

fn main() {

  let seed = 42;
  
  let mut sm: SplitMix64 = SeedableRng::from_seed(seed);
  let mut rng: Xorshift1024 = Rand::rand(&mut sm);
  
  let mut rng2 = rng;
  
  rng.next_u64();
  rng.next_u64();
  
  rng2.jump(2);
  
  assert_eq!(rng.next_u64(), rng2.next_u64());
}

MyZeD avatar Mar 07 '21 14:03 MyZeD