@@ -75,7 +75,11 @@ impl ReseedingCore {
7575}
7676
7777/// The [`ThreadRng`] internal
78- struct ThreadRngCore {
78+ ///
79+ /// This type is the actual pseudo-random number generator that powers [`ThreadRng`]. The same
80+ /// Security design criteria and consideration as those of [`ThreadRng`] apply, whereas it allows
81+ /// users to utilize the same reseeding generator where `Send` or `Sync` is required.
82+ pub struct ThreadRngCore {
7983 inner : BlockRng < ReseedingCore > ,
8084}
8185
@@ -88,7 +92,7 @@ impl fmt::Debug for ThreadRngCore {
8892
8993impl ThreadRngCore {
9094 /// Initialize the generator using [`SysRng`]
91- fn new ( ) -> Result < Self , SysError > {
95+ pub fn new ( ) -> Result < Self , SysError > {
9296 Core :: try_from_rng ( & mut SysRng ) . map ( |result| Self {
9397 inner : BlockRng :: new ( ReseedingCore { inner : result } ) ,
9498 } )
@@ -97,7 +101,7 @@ impl ThreadRngCore {
97101 /// Immediately reseed the generator
98102 ///
99103 /// This discards any remaining random data in the cache.
100- fn reseed ( & mut self ) -> Result < ( ) , SysError > {
104+ pub fn reseed ( & mut self ) -> Result < ( ) , SysError > {
101105 self . inner . reset_and_skip ( 0 ) ;
102106 self . inner . core . reseed ( )
103107 }
@@ -140,7 +144,7 @@ impl TryCryptoRng for ThreadRngCore {}
140144///
141145/// - Automatic seeding via [`SysRng`] and after every 64 kB of output.
142146/// Limitation: there is no automatic reseeding on process fork (see [below](#fork)).
143- /// - A rigorusly analyzed, unpredictable (cryptographic) pseudo-random generator
147+ /// - A rigorously analyzed, unpredictable (cryptographic) pseudo-random generator
144148/// (see [the book on security](https://rust-random.github.io/book/guide-rngs.html#security)).
145149/// The currently selected algorithm is ChaCha (12-rounds).
146150/// See also [`StdRng`] documentation.
0 commit comments