66// option. This file may not be copied, modified, or distributed
77// except according to those terms.
88
9- use rand_core:: le:: { fill_bytes_via_next, next_u64_via_u32, read_u32_into} ;
10- use rand_core:: { RngCore , SeedableRng } ;
9+ use rand_core:: { RngCore , SeedableRng , utils} ;
1110#[ cfg( feature = "serde" ) ]
1211use serde:: { Deserialize , Serialize } ;
1312
@@ -63,9 +62,9 @@ impl SeedableRng for Xoshiro128PlusPlus {
6362 #[ inline]
6463 fn from_seed ( seed : [ u8 ; 16 ] ) -> Xoshiro128PlusPlus {
6564 deal_with_zero_seed ! ( seed, Self , 16 ) ;
66- let mut state = [ 0 ; 4 ] ;
67- read_u32_into ( & seed, & mut state ) ;
68- Xoshiro128PlusPlus { s : state }
65+ Xoshiro128PlusPlus {
66+ s : utils :: read_words ( & seed) ,
67+ }
6968 }
7069
7170 /// Seed a `Xoshiro128PlusPlus` from a `u64` using `SplitMix64`.
@@ -84,12 +83,12 @@ impl RngCore for Xoshiro128PlusPlus {
8483
8584 #[ inline]
8685 fn next_u64 ( & mut self ) -> u64 {
87- next_u64_via_u32 ( self )
86+ utils :: next_u64_via_u32 ( self )
8887 }
8988
9089 #[ inline]
9190 fn fill_bytes ( & mut self , dest : & mut [ u8 ] ) {
92- fill_bytes_via_next ( self , dest ) ;
91+ utils :: fill_bytes_via_next_word ( dest , || self . next_u32 ( ) ) ;
9392 }
9493}
9594
0 commit comments