@@ -119,6 +119,13 @@ impl SeedableRng for IsaacRng {
119119    fn  from_seed ( seed :  Self :: Seed )  -> Self  { 
120120        IsaacRng ( BlockRng :: < IsaacCore > :: from_seed ( seed) ) 
121121    } 
122+     
123+     /// Create an ISAAC random number generator using an `u64` as seed. 
124+      /// If `seed == 0` this will produce the same stream of random numbers as 
125+      /// the reference implementation when used unseeded. 
126+      fn  seed_from_u64 ( seed :  u64 )  -> Self  { 
127+         IsaacRng ( BlockRng :: < IsaacCore > :: seed_from_u64 ( seed) ) 
128+     } 
122129
123130    fn  from_rng < S :  RngCore > ( rng :  S )  -> Result < Self ,  Error >  { 
124131        BlockRng :: < IsaacCore > :: from_rng ( rng) . map ( |rng| IsaacRng ( rng) ) 
@@ -129,8 +136,9 @@ impl IsaacRng {
129136    /// Create an ISAAC random number generator using an `u64` as seed. 
130137     /// If `seed == 0` this will produce the same stream of random numbers as 
131138     /// the reference implementation when used unseeded. 
139+      #[ deprecated( since="0.6.0" ,  note="use SeedableRng::seed_from_u64 instead" ) ]  
132140    pub  fn  new_from_u64 ( seed :  u64 )  -> Self  { 
133-         IsaacRng ( BlockRng :: new ( IsaacCore :: new_from_u64 ( seed) ) ) 
141+         Self :: seed_from_u64 ( seed) 
134142    } 
135143} 
136144
@@ -301,22 +309,6 @@ impl IsaacCore {
301309
302310        Self  {  mem,  a :  w ( 0 ) ,  b :  w ( 0 ) ,  c :  w ( 0 )  } 
303311    } 
304- 
305-     /// Create an ISAAC random number generator using an `u64` as seed. 
306-      /// If `seed == 0` this will produce the same stream of random numbers as 
307-      /// the reference implementation when used unseeded. 
308-      fn  new_from_u64 ( seed :  u64 )  -> Self  { 
309-         let  mut  key = [ w ( 0 ) ;  RAND_SIZE ] ; 
310-         key[ 0 ]  = w ( seed as  u32 ) ; 
311-         key[ 1 ]  = w ( ( seed >> 32 )  as  u32 ) ; 
312-         // Initialize with only one pass. 
313-         // A second pass does not improve the quality here, because all of the 
314-         // seed was already available in the first round. 
315-         // Not doing the second pass has the small advantage that if 
316-         // `seed == 0` this method produces exactly the same state as the 
317-         // reference implementation when used unseeded. 
318-         Self :: init ( key,  1 ) 
319-     } 
320312} 
321313
322314impl  SeedableRng  for  IsaacCore  { 
@@ -332,6 +324,22 @@ impl SeedableRng for IsaacCore {
332324        } 
333325        Self :: init ( seed_extended,  2 ) 
334326    } 
327+     
328+     /// Create an ISAAC random number generator using an `u64` as seed. 
329+      /// If `seed == 0` this will produce the same stream of random numbers as 
330+      /// the reference implementation when used unseeded. 
331+      fn  seed_from_u64 ( seed :  u64 )  -> Self  { 
332+         let  mut  key = [ w ( 0 ) ;  RAND_SIZE ] ; 
333+         key[ 0 ]  = w ( seed as  u32 ) ; 
334+         key[ 1 ]  = w ( ( seed >> 32 )  as  u32 ) ; 
335+         // Initialize with only one pass. 
336+         // A second pass does not improve the quality here, because all of the 
337+         // seed was already available in the first round. 
338+         // Not doing the second pass has the small advantage that if 
339+         // `seed == 0` this method produces exactly the same state as the 
340+         // reference implementation when used unseeded. 
341+         Self :: init ( key,  1 ) 
342+     } 
335343
336344    fn  from_rng < R :  RngCore > ( mut  rng :  R )  -> Result < Self ,  Error >  { 
337345        // Custom `from_rng` implementation that fills a seed with the same size 
@@ -425,11 +433,11 @@ mod test {
425433    #[ test]  
426434    fn  test_isaac_new_uninitialized ( )  { 
427435        // Compare the results from initializing `IsaacRng` with 
428-         // `new_from_u64 (0)`, to make sure it is the same as the reference 
436+         // `seed_from_u64 (0)`, to make sure it is the same as the reference 
429437        // implementation when used uninitialized. 
430438        // Note: We only test the first 16 integers, not the full 256 of the 
431439        // first block. 
432-         let  mut  rng = IsaacRng :: new_from_u64 ( 0 ) ; 
440+         let  mut  rng = IsaacRng :: seed_from_u64 ( 0 ) ; 
433441        let  mut  results = [ 0u32 ;  16 ] ; 
434442        for  i in  results. iter_mut ( )  {  * i = rng. next_u32 ( ) ;  } 
435443        let  expected:  [ u32 ;  16 ]  = [ 
0 commit comments