@@ -103,13 +103,13 @@ pub mod rngs;
103
103
pub mod seq;
104
104
105
105
// Public exports
106
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
106
+ #[ cfg( feature = "thread_rng" ) ]
107
107
pub use crate :: rngs:: thread:: rng;
108
108
109
109
/// Access the thread-local generator
110
110
///
111
111
/// Use [`rand::rng()`](rng()) instead.
112
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
112
+ #[ cfg( feature = "thread_rng" ) ]
113
113
#[ deprecated( since = "0.9.0" , note = "renamed to `rng`" ) ]
114
114
#[ inline]
115
115
pub fn thread_rng ( ) -> crate :: rngs:: ThreadRng {
@@ -118,7 +118,7 @@ pub fn thread_rng() -> crate::rngs::ThreadRng {
118
118
119
119
pub use rng:: { Fill , Rng } ;
120
120
121
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
121
+ #[ cfg( feature = "thread_rng" ) ]
122
122
use crate :: distr:: { Distribution , StandardUniform } ;
123
123
124
124
/// Generate a random value using the thread-local random number generator.
@@ -159,7 +159,7 @@ use crate::distr::{Distribution, StandardUniform};
159
159
///
160
160
/// [`StandardUniform`]: distr::StandardUniform
161
161
/// [`ThreadRng`]: rngs::ThreadRng
162
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
162
+ #[ cfg( feature = "thread_rng" ) ]
163
163
#[ inline]
164
164
pub fn random < T > ( ) -> T
165
165
where
@@ -179,7 +179,7 @@ where
179
179
/// let v: Vec<i32> = rand::random_iter().take(5).collect();
180
180
/// println!("{v:?}");
181
181
/// ```
182
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
182
+ #[ cfg( feature = "thread_rng" ) ]
183
183
#[ inline]
184
184
pub fn random_iter < T > ( ) -> distr:: DistIter < StandardUniform , rngs:: ThreadRng , T >
185
185
where
@@ -204,7 +204,7 @@ where
204
204
/// ```
205
205
/// Note that the first example can also be achieved (without `collect`'ing
206
206
/// to a `Vec`) using [`seq::IteratorRandom::choose`].
207
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
207
+ #[ cfg( feature = "thread_rng" ) ]
208
208
#[ inline]
209
209
pub fn random_range < T , R > ( range : R ) -> T
210
210
where
@@ -228,7 +228,7 @@ where
228
228
/// # Panics
229
229
///
230
230
/// If `p < 0` or `p > 1`.
231
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
231
+ #[ cfg( feature = "thread_rng" ) ]
232
232
#[ inline]
233
233
#[ track_caller]
234
234
pub fn random_bool ( p : f64 ) -> bool {
@@ -260,7 +260,7 @@ pub fn random_bool(p: f64) -> bool {
260
260
/// ```
261
261
///
262
262
/// [`Bernoulli`]: distr::Bernoulli
263
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
263
+ #[ cfg( feature = "thread_rng" ) ]
264
264
#[ inline]
265
265
#[ track_caller]
266
266
pub fn random_ratio ( numerator : u32 , denominator : u32 ) -> bool {
@@ -282,7 +282,7 @@ pub fn random_ratio(numerator: u32, denominator: u32) -> bool {
282
282
/// Note that you can instead use [`random()`] to generate an array of random
283
283
/// data, though this is slower for small elements (smaller than the RNG word
284
284
/// size).
285
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
285
+ #[ cfg( feature = "thread_rng" ) ]
286
286
#[ inline]
287
287
#[ track_caller]
288
288
pub fn fill < T : Fill + ?Sized > ( dest : & mut T ) {
@@ -302,7 +302,7 @@ mod test {
302
302
}
303
303
304
304
#[ test]
305
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
305
+ #[ cfg( feature = "thread_rng" ) ]
306
306
fn test_random ( ) {
307
307
let _n: u64 = random ( ) ;
308
308
let _f: f32 = random ( ) ;
@@ -316,7 +316,7 @@ mod test {
316
316
}
317
317
318
318
#[ test]
319
- #[ cfg( all ( feature = "std" , feature = "std_rng" , feature = "os_rng" ) ) ]
319
+ #[ cfg( feature = "thread_rng" ) ]
320
320
fn test_range ( ) {
321
321
let _n: usize = random_range ( 42 ..=43 ) ;
322
322
let _f: f32 = random_range ( 42.0 ..43.0 ) ;
0 commit comments