Skip to content

Commit 8485698

Browse files
committed
Expose ThreadRngCore to public
1 parent d7ab657 commit 8485698

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ A [separate changelog is kept for rand_core](https://github.com/rust-random/core
88

99
You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.html) useful.
1010

11+
## [Unreleased]
12+
13+
### Additions
14+
- Expose `ThreadRngCore` ([#1750])
15+
16+
[#1750]: https://github.com/rust-random/rand/pull/1750
17+
1118
## [0.10.0] - 2026-02-08
1219

1320
### Changes

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
@@ -76,9 +76,10 @@ impl ReseedingCore {
7676

7777
/// The [`ThreadRng`] internal
7878
///
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.
79+
/// This type is the underlying, periodically seeded pseudorandom number generator that powers
80+
/// [`ThreadRng`]. The same Security design criteria and consideration as those of [`ThreadRng`]
81+
/// apply, whereas it allows users to utilize the same reseeding generator where `Send` or `Sync`
82+
/// is required.
8283
pub struct ThreadRngCore {
8384
inner: BlockRng<ReseedingCore>,
8485
}

0 commit comments

Comments
 (0)