Skip to content

Commit

Permalink
Isaac64: add test for true 32-bit values
Browse files Browse the repository at this point in the history
Includes both the values output now and the values which should be output by #36.

[Cherry-picked from fd2660b]
  • Loading branch information
dhardy committed Dec 27, 2017
1 parent 164f289 commit a7e9d77
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/prng/isaac64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,28 @@ mod test {
10391409374914919106));
}

#[test]
fn test_isaac64_true_values_32() {
let seed: &[_] = &[1, 23, 456, 7890, 12345];
let mut rng1 = Isaac64Rng::from_seed(seed);
let v = (0..10).map(|_| rng1.next_u32()).collect::<Vec<_>>();
// Subset of above values, as an LE u32 sequence
// TODO: switch to this sequence?
// assert_eq!(v,
// [141028748, 127386717,
// 1058730652, 3347555894,
// 851491469, 4039984500,
// 2692730210, 288449107,
// 646103879, 2782923823]);
// Subset of above values, using only low-half of each u64
assert_eq!(v,
[141028748, 1058730652,
851491469, 2692730210,
646103879, 4195642895,
2836348583, 1312677241,
999139615, 253604626]);
}

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

0 comments on commit a7e9d77

Please sign in to comment.