Skip to content

Commit fd2660b

Browse files
committed
Isaac64: add test for true 32-bit values
Includes both the values output now and the values which should be output by dhardy#36.
1 parent ae365ef commit 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
@@ -371,6 +371,28 @@ mod test {
371371
11788097613744130851, 10391409374914919106));
372372
}
373373

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

0 commit comments

Comments
 (0)