Skip to content

Commit 42532e5

Browse files
committed
Test next_u64 on 32-bit generator to check LE conversion
1 parent 116cc67 commit 42532e5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/prng/isaac.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,17 @@ mod test {
428428
1576568959, 3507990155, 179069555, 141456972, 2478885421));
429429
}
430430

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

0 commit comments

Comments
 (0)