From c5eb0dada30a4e1f12ba2f8ee6b0bda83b1efb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 30 Oct 2024 14:49:44 +0300 Subject: [PATCH] Remove src/rngs/thread.rs --- src/rngs/mod.rs | 4 +--- src/rngs/thread.rs | 43 ------------------------------------------- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 src/rngs/thread.rs diff --git a/src/rngs/mod.rs b/src/rngs/mod.rs index 6f82d7d257..6a220ee856 100644 --- a/src/rngs/mod.rs +++ b/src/rngs/mod.rs @@ -95,15 +95,13 @@ mod xoshiro256plusplus; #[cfg(feature = "std_rng")] mod std; -#[cfg(all(feature = "std", feature = "std_rng", feature = "getrandom"))] -pub(crate) mod thread; #[cfg(feature = "small_rng")] pub use self::small::SmallRng; #[cfg(feature = "std_rng")] pub use self::std::StdRng; #[cfg(feature = "thread_rng")] -pub use self::thread::ThreadRng; +pub use rand_trng::{rng, ThreadRng}; #[cfg(feature = "getrandom")] pub use rand_core::OsRng; diff --git a/src/rngs/thread.rs b/src/rngs/thread.rs deleted file mode 100644 index 7fddb7cab8..0000000000 --- a/src/rngs/thread.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 Developers of the Rand project. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Thread-local random number generator - -pub use rand_trng::ThreadRng; - -/// Access a fast, pre-initialized generator -/// -/// This is a handle to the local [`ThreadRng`]. -/// -/// See also [`crate::rngs`] for alternatives. -/// -/// # Example -/// -/// ``` -/// use rand::prelude::*; -/// -/// # fn main() { -/// -/// let mut numbers = [1, 2, 3, 4, 5]; -/// numbers.shuffle(&mut rand::rng()); -/// println!("Numbers: {numbers:?}"); -/// -/// // Using a local binding avoids an initialization-check on each usage: -/// let mut rng = rand::rng(); -/// -/// println!("True or false: {}", rng.random::()); -/// println!("A simulated die roll: {}", rng.random_range(1..=6)); -/// # } -/// ``` -/// -/// # Security -/// -/// Refer to [`ThreadRng#Security`]. -pub fn rng() -> ThreadRng { - rand_trng::rng() -}