Skip to content

Commit 12bf233

Browse files
committed
fix docs
1 parent 1dc70c8 commit 12bf233

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

thread-rng/src/lib.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl RngCore for ReseedingRng {
8585

8686
impl CryptoRng for ReseedingRng {}
8787

88-
/// A reference to the thread-local generator
88+
/// A reference to the thread-local generator.
8989
///
9090
/// This type is a reference to a lazily-initialized thread-local generator.
9191
/// An instance can be obtained via [`rand::rng()`][crate::rng()] or via
@@ -98,15 +98,13 @@ impl CryptoRng for ReseedingRng {}
9898
/// requirements. The Rand project can provide no guarantee of fitness for
9999
/// purpose. The design criteria for `ThreadRng` are as follows:
100100
///
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
103103
/// reseeding on process fork (see [below](#fork)).
104104
/// - A rigorusly analyzed, unpredictable (cryptographic) pseudo-random generator
105105
/// (see [the book on security](https://rust-random.github.io/book/guide-rngs.html#security)).
106106
/// 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.
110108
/// - No further protections exist to in-memory state. In particular, the
111109
/// implementation is not required to zero memory on exit (of the process or
112110
/// thread). (This may change in the future.)
@@ -135,8 +133,7 @@ impl CryptoRng for ReseedingRng {}
135133
/// from an interrupt (e.g. a fork handler) unless it can be guaranteed that no
136134
/// other method on the same `ThreadRng` is currently executing.
137135
///
138-
/// [`ReseedingRng`]: crate::rngs::ReseedingRng
139-
/// [`StdRng`]: crate::rngs::StdRng
136+
/// [`OsRng`]: rand_core::OsRng
140137
#[derive(Clone)]
141138
pub struct ThreadRng {
142139
// Rc is explicitly !Send and !Sync
@@ -170,7 +167,7 @@ impl fmt::Debug for ThreadRng {
170167

171168
thread_local!(
172169
// 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.
174171
static THREAD_RNG_KEY: Rc<UnsafeCell<ReseedingRng>> = {
175172
let rng = ChaCha12Rng::try_from_os_rng().unwrap_or_else(|err|
176173
panic!("could not initialize ThreadRng: {}", err));
@@ -183,8 +180,6 @@ thread_local!(
183180
///
184181
/// This is a handle to the local [`ThreadRng`].
185182
///
186-
/// See also [`crate::rngs`] for alternatives.
187-
///
188183
/// # Example
189184
///
190185
/// ```

0 commit comments

Comments
 (0)