Skip to content

Commit

Permalink
Test next_u64 on 32-bit generator to check LE conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Dec 27, 2017
1 parent 31dd85d commit bf9f905
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/prng/isaac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,17 @@ mod test {
1576568959, 3507990155, 179069555, 141456972, 2478885421));
}

#[test]
fn test_rng_64_true_values() {
// As above, using little-endian versions of above values
let seed: &[_] = &[1, 23, 456, 7890, 12345];
let mut ra: IsaacRng = SeedableRng::from_seed(seed);
// Regression test that isaac is actually using the above vector
let v = (0..5).map(|_| ra.next_u64()).collect::<Vec<_>>();
assert_eq!(v,
vec!(3752888579798383186, 9035083239252078381, 18052294697452424037, 11876559110374379111, 16751462502657800130));
}

#[test]
fn test_isaac_true_bytes() {
let seed: &[_] = &[1, 23, 456, 7890, 12345];
Expand Down

0 comments on commit bf9f905

Please sign in to comment.