Skip to content

Commit 5d0396c

Browse files
committed
Expose ThreadRngCore to public
1 parent c2fbe08 commit 5d0396c

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.
1010

1111
## [Unreleased]
1212

13+
### Additions
14+
- Expose `ThreadRngCore` ([#1750])
15+
1316
### Changes
1417
- Document required output order of fn `partial_shuffle` and apply `#[must_use]` ([#1769])
1518

19+
[#1750]: https://github.com/rust-random/rand/pull/1750
1620
[#1769]: https://github.com/rust-random/rand/pull/1769
1721

1822
## [0.10.1] — 2026-02-11

src/rngs/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
//!
5353
//! ### Additional generators
5454
//!
55+
//! - [`ThreadRngCore`] is the underlying, periodically seeded PRNG of
56+
//! [`ThreadRng`] that allows users to utilize the same reseeding generator
57+
//! where `Send` or `Sync` is required.
5558
//! - The [`rdrand`] crate provides an interface to the RDRAND and RDSEED
5659
//! instructions available in modern Intel and AMD CPUs.
5760
//! - The [`rand_jitter`] crate provides a user-space implementation of
@@ -110,7 +113,7 @@ pub use xoshiro256plusplus::Xoshiro256PlusPlus;
110113
#[cfg(feature = "std_rng")]
111114
pub use self::std::StdRng;
112115
#[cfg(feature = "thread_rng")]
113-
pub use self::thread::ThreadRng;
116+
pub use self::thread::{ThreadRng, ThreadRngCore};
114117

115118
#[cfg(feature = "chacha")]
116119
pub use chacha20::{ChaCha8Rng, ChaCha12Rng, ChaCha20Rng};

src/rngs/thread.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ impl ReseedingCore {
7474

7575
/// The [`ThreadRng`] internal
7676
///
77-
/// This type is the actual pseudo-random number generator that powers [`ThreadRng`]. The same
78-
/// Security design criteria and consideration as those of [`ThreadRng`] apply, whereas it allows
79-
/// users to utilize the same reseeding generator where `Send` or `Sync` is required.
77+
/// This type is the underlying, periodically seeded pseudorandom number generator that powers
78+
/// [`ThreadRng`]. The same Security design criteria and consideration as those of [`ThreadRng`]
79+
/// apply, whereas it allows users to utilize the same reseeding generator where `Send` or `Sync`
80+
/// is required.
8081
pub struct ThreadRngCore {
8182
inner: BlockRng<ReseedingCore>,
8283
}

0 commit comments

Comments
 (0)