@@ -85,7 +85,7 @@ impl RngCore for ReseedingRng {
85
85
86
86
impl CryptoRng for ReseedingRng { }
87
87
88
- /// A reference to the thread-local generator
88
+ /// A reference to the thread-local generator.
89
89
///
90
90
/// This type is a reference to a lazily-initialized thread-local generator.
91
91
/// An instance can be obtained via [`rand::rng()`][crate::rng()] or via
@@ -98,15 +98,13 @@ impl CryptoRng for ReseedingRng {}
98
98
/// requirements. The Rand project can provide no guarantee of fitness for
99
99
/// purpose. The design criteria for `ThreadRng` are as follows:
100
100
///
101
- /// - Automatic seeding via [`OsRng`] and periodically thereafter (see
102
- /// ([`ReseedingRng`] documentation) . Limitation: there is no automatic
101
+ /// - Automatic seeding via [`OsRng`] and periodically thereafter after every 64 KiB of
102
+ /// generated data . Limitation: there is no automatic
103
103
/// reseeding on process fork (see [below](#fork)).
104
104
/// - A rigorusly analyzed, unpredictable (cryptographic) pseudo-random generator
105
105
/// (see [the book on security](https://rust-random.github.io/book/guide-rngs.html#security)).
106
106
/// The currently selected algorithm is ChaCha (12-rounds).
107
- /// See also [`StdRng`] documentation.
108
- /// - Not to leak internal state through [`Debug`] or serialization
109
- /// implementations.
107
+ /// - Not to leak internal state through [`Debug`] or serialization implementations.
110
108
/// - No further protections exist to in-memory state. In particular, the
111
109
/// implementation is not required to zero memory on exit (of the process or
112
110
/// thread). (This may change in the future.)
@@ -135,8 +133,7 @@ impl CryptoRng for ReseedingRng {}
135
133
/// from an interrupt (e.g. a fork handler) unless it can be guaranteed that no
136
134
/// other method on the same `ThreadRng` is currently executing.
137
135
///
138
- /// [`ReseedingRng`]: crate::rngs::ReseedingRng
139
- /// [`StdRng`]: crate::rngs::StdRng
136
+ /// [`OsRng`]: rand_core::OsRng
140
137
#[ derive( Clone ) ]
141
138
pub struct ThreadRng {
142
139
// Rc is explicitly !Send and !Sync
@@ -170,7 +167,7 @@ impl fmt::Debug for ThreadRng {
170
167
171
168
thread_local ! (
172
169
// We require Rc<..> to avoid premature freeing when ThreadRng is used
173
- // within thread-local destructors. See # 968.
170
+ // within thread-local destructors. See https://github.com/rust-random/rand/issues/ 968.
174
171
static THREAD_RNG_KEY : Rc <UnsafeCell <ReseedingRng >> = {
175
172
let rng = ChaCha12Rng :: try_from_os_rng( ) . unwrap_or_else( |err|
176
173
panic!( "could not initialize ThreadRng: {}" , err) ) ;
@@ -183,8 +180,6 @@ thread_local!(
183
180
///
184
181
/// This is a handle to the local [`ThreadRng`].
185
182
///
186
- /// See also [`crate::rngs`] for alternatives.
187
- ///
188
183
/// # Example
189
184
///
190
185
/// ```
0 commit comments