@@ -490,48 +490,6 @@ pub trait SeedableRng: Sized {
490490 rng. try_fill_bytes ( seed. as_mut ( ) ) ?;
491491 Ok ( Self :: from_seed ( seed) )
492492 }
493-
494- /// Creates a new instance of the RNG seeded via [`getrandom`].
495- ///
496- /// This method is the recommended way to construct non-deterministic PRNGs
497- /// since it is convenient and secure.
498- ///
499- /// Note that this method may panic on (extremely unlikely) [`getrandom`] errors.
500- /// If it's not desirable, use the [`try_from_os_rng`] method instead.
501- ///
502- /// In case the overhead of using [`getrandom`] to seed *many* PRNGs is an
503- /// issue, one may prefer to seed from a local PRNG, e.g.
504- /// `from_rng(rand::rng()).unwrap()`.
505- ///
506- /// # Panics
507- ///
508- /// If [`getrandom`] is unable to provide secure entropy this method will panic.
509- ///
510- /// [`getrandom`]: https://docs.rs/getrandom
511- /// [`try_from_os_rng`]: SeedableRng::try_from_os_rng
512- #[ cfg( feature = "os_rng" ) ]
513- fn from_os_rng ( ) -> Self {
514- match Self :: try_from_os_rng ( ) {
515- Ok ( res) => res,
516- Err ( err) => panic ! ( "from_os_rng failed: {}" , err) ,
517- }
518- }
519-
520- /// Creates a new instance of the RNG seeded via [`getrandom`] without unwrapping
521- /// potential [`getrandom`] errors.
522- ///
523- /// In case the overhead of using [`getrandom`] to seed *many* PRNGs is an
524- /// issue, one may prefer to seed from a local PRNG, e.g.
525- /// `from_rng(&mut rand::rng()).unwrap()`.
526- ///
527- /// [`getrandom`]: https://docs.rs/getrandom
528- #[ cfg( feature = "os_rng" ) ]
529- fn try_from_os_rng ( ) -> Result < Self , getrandom:: Error > {
530- let mut seed = Self :: Seed :: default ( ) ;
531- getrandom:: fill ( seed. as_mut ( ) ) ?;
532- let res = Self :: from_seed ( seed) ;
533- Ok ( res)
534- }
535493}
536494
537495#[ cfg( test) ]
0 commit comments