Skip to content

Commit a7e9d77

Browse files
committedDec 27, 2017
Isaac64: add test for true 32-bit values
Includes both the values output now and the values which should be output by #36. [Cherry-picked from fd2660b]

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎src/prng/isaac64.rs

+22
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,28 @@ mod test {
374374
10391409374914919106));
375375
}
376376

377+
#[test]
378+
fn test_isaac64_true_values_32() {
379+
let seed: &[_] = &[1, 23, 456, 7890, 12345];
380+
let mut rng1 = Isaac64Rng::from_seed(seed);
381+
let v = (0..10).map(|_| rng1.next_u32()).collect::<Vec<_>>();
382+
// Subset of above values, as an LE u32 sequence
383+
// TODO: switch to this sequence?
384+
// assert_eq!(v,
385+
// [141028748, 127386717,
386+
// 1058730652, 3347555894,
387+
// 851491469, 4039984500,
388+
// 2692730210, 288449107,
389+
// 646103879, 2782923823]);
390+
// Subset of above values, using only low-half of each u64
391+
assert_eq!(v,
392+
[141028748, 1058730652,
393+
851491469, 2692730210,
394+
646103879, 4195642895,
395+
2836348583, 1312677241,
396+
999139615, 253604626]);
397+
}
398+
377399
#[test]
378400
fn test_isaac64_true_bytes() {
379401
let seed: &[_] = &[1, 23, 456, 7890, 12345];

0 commit comments

Comments
 (0)
Please sign in to comment.