@@ -403,21 +403,39 @@ mod test {
403
403
596345674630742204 , 9947027391921273664 , 11788097613744130851 ,
404
404
10391409374914919106 ) ) ;
405
405
}
406
-
406
+
407
407
#[ test]
408
408
fn test_isaac64_true_values_32 ( ) {
409
409
let seed: & [ _ ] = & [ 1 , 23 , 456 , 7890 , 12345 ] ;
410
410
let mut rng1 = Isaac64Rng :: from_seed ( seed) ;
411
- let v = ( 0 ..10 ) . map ( |_| rng1. next_u32 ( ) ) . collect :: < Vec < _ > > ( ) ;
411
+ let v = ( 0 ..12 ) . map ( |_| rng1. next_u32 ( ) ) . collect :: < Vec < _ > > ( ) ;
412
412
// Subset of above values, as an LE u32 sequence
413
413
assert_eq ! ( v,
414
414
[ 141028748 , 127386717 ,
415
415
1058730652 , 3347555894 ,
416
416
851491469 , 4039984500 ,
417
417
2692730210 , 288449107 ,
418
- 646103879 , 2782923823 ] ) ;
418
+ 646103879 , 2782923823 ,
419
+ 4195642895 , 3252674613 ] ) ;
419
420
}
420
-
421
+
422
+ #[ test]
423
+ fn test_isaac64_true_values_mixed ( ) {
424
+ let seed: & [ _ ] = & [ 1 , 23 , 456 , 7890 , 12345 ] ;
425
+ let mut rng = Isaac64Rng :: from_seed ( seed) ;
426
+ // Test alternating between `next_u64` and `next_u32` works as expected.
427
+ // Values are the same as `test_isaac64_true_values` and
428
+ // `test_isaac64_true_values_32`.
429
+ assert_eq ! ( rng. next_u64( ) , 547121783600835980 ) ;
430
+ assert_eq ! ( rng. next_u32( ) , 1058730652 ) ;
431
+ assert_eq ! ( rng. next_u32( ) , 3347555894 ) ;
432
+ assert_eq ! ( rng. next_u64( ) , 17351601304698403469 ) ;
433
+ assert_eq ! ( rng. next_u32( ) , 2692730210 ) ;
434
+ // Skip one u32
435
+ assert_eq ! ( rng. next_u64( ) , 11952566807690396487 ) ;
436
+ assert_eq ! ( rng. next_u32( ) , 4195642895 ) ;
437
+ }
438
+
421
439
#[ test]
422
440
fn test_isaac64_true_bytes ( ) {
423
441
let seed: & [ _ ] = & [ 1 , 23 , 456 , 7890 , 12345 ] ;
@@ -431,7 +449,7 @@ mod test {
431
449
141 , 186 , 192 , 50 , 116 , 69 , 205 , 240 ,
432
450
98 , 205 , 127 , 160 , 83 , 98 , 49 , 17 ] ) ;
433
451
}
434
-
452
+
435
453
#[ test]
436
454
fn test_isaac_new_uninitialized ( ) {
437
455
// Compare the results from initializing `IsaacRng` with
0 commit comments