Skip to content

Commit 075593f

Browse files
committed
Readd weak_rng with a deprecation warning
1 parent 3119279 commit 075593f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,23 @@ impl SeedableRng for SmallRng {
11391139
}
11401140
}
11411141

1142+
/// DEPRECATED: use `SmallRng` instead.
1143+
///
1144+
/// Create a weak random number generator with a default algorithm and seed.
1145+
///
1146+
/// It returns the fastest `Rng` algorithm currently available in Rust without
1147+
/// consideration for cryptography or security. If you require a specifically
1148+
/// seeded `Rng` for consistency over time you should pick one algorithm and
1149+
/// create the `Rng` yourself.
1150+
///
1151+
/// This will seed the generator with randomness from thread_rng.
1152+
#[deprecated(since="0.5.0", note="removed in favor of SmallRng")]
1153+
#[cfg(feature="std")]
1154+
pub fn weak_rng() -> XorShiftRng {
1155+
XorShiftRng::from_rng(&mut thread_rng()).unwrap_or_else(|err|
1156+
panic!("weak_rng failed: {:?}", err))
1157+
}
1158+
11421159
/// DEPRECATED: use `seq::sample_iter` instead.
11431160
///
11441161
/// Randomly sample up to `amount` elements from a finite iterator.

0 commit comments

Comments
 (0)