@@ -392,52 +392,6 @@ pub trait RngCore {
392
392
impls:: next_u64_via_u32 ( self )
393
393
}
394
394
395
- /// Return the next random f32 selected from the half-open
396
- /// interval `[0, 1)`.
397
- ///
398
- /// This uses a technique described by Saito and Matsumoto at
399
- /// MCQMC'08. Given that the IEEE floating point numbers are
400
- /// uniformly distributed over [1,2), we generate a number in
401
- /// this range and then offset it onto the range [0,1). Our
402
- /// choice of bits (masking v. shifting) is arbitrary and
403
- /// should be immaterial for high quality generators. For low
404
- /// quality generators (ex. LCG), prefer bitshifting due to
405
- /// correlation between sequential low order bits.
406
- ///
407
- /// See:
408
- /// A PRNG specialized in double precision floating point numbers using
409
- /// an affine transition
410
- ///
411
- /// * <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/dSFMT.pdf>
412
- /// * <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-slide-e.pdf>
413
- ///
414
- /// By default this is implemented in terms of `next_u32`, but a
415
- /// random number generator which can generate numbers satisfying
416
- /// the requirements directly can overload this for performance.
417
- /// It is required that the return value lies in `[0, 1)`.
418
- fn next_f32 ( & mut self ) -> f32 {
419
- const UPPER_MASK : u32 = 0x3F800000 ;
420
- const LOWER_MASK : u32 = 0x7FFFFF ;
421
- let tmp = UPPER_MASK | ( self . next_u32 ( ) & LOWER_MASK ) ;
422
- let result: f32 = unsafe { mem:: transmute ( tmp) } ;
423
- result - 1.0
424
- }
425
-
426
- /// Return the next random f64 selected from the half-open
427
- /// interval `[0, 1)`.
428
- ///
429
- /// By default this is implemented in terms of `next_u64`, but a
430
- /// random number generator which can generate numbers satisfying
431
- /// the requirements directly can overload this for performance.
432
- /// It is required that the return value lies in `[0, 1)`.
433
- fn next_f64 ( & mut self ) -> f64 {
434
- const UPPER_MASK : u64 = 0x3FF0000000000000 ;
435
- const LOWER_MASK : u64 = 0xFFFFFFFFFFFFF ;
436
- let tmp = UPPER_MASK | ( self . next_u64 ( ) & LOWER_MASK ) ;
437
- let result: f64 = unsafe { mem:: transmute ( tmp) } ;
438
- result - 1.0
439
- }
440
-
441
395
/// Fill `dest` with random data.
442
396
///
443
397
/// Implementations of this trait must implement at least one of
@@ -758,16 +712,6 @@ impl<'a, R: RngCore + ?Sized> RngCore for &'a mut R {
758
712
( * * self ) . next_u64 ( )
759
713
}
760
714
761
- #[ inline]
762
- fn next_f32 ( & mut self ) -> f32 {
763
- ( * * self ) . next_f32 ( )
764
- }
765
-
766
- #[ inline]
767
- fn next_f64 ( & mut self ) -> f64 {
768
- ( * * self ) . next_f64 ( )
769
- }
770
-
771
715
#[ inline]
772
716
fn fill_bytes ( & mut self , dest : & mut [ u8 ] ) {
773
717
( * * self ) . fill_bytes ( dest)
@@ -791,16 +735,6 @@ impl<R: RngCore + ?Sized> RngCore for Box<R> {
791
735
( * * self ) . next_u64 ( )
792
736
}
793
737
794
- #[ inline]
795
- fn next_f32 ( & mut self ) -> f32 {
796
- ( * * self ) . next_f32 ( )
797
- }
798
-
799
- #[ inline]
800
- fn next_f64 ( & mut self ) -> f64 {
801
- ( * * self ) . next_f64 ( )
802
- }
803
-
804
738
#[ inline]
805
739
fn fill_bytes ( & mut self , dest : & mut [ u8 ] ) {
806
740
( * * self ) . fill_bytes ( dest)
0 commit comments