Skip to content

Commit 2cf9acb

Browse files
committed
Make sure XorShiftRng is deprecated
1 parent a385938 commit 2cf9acb

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/deprecated.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ impl CryptoRng for ChaChaRng {}
170170

171171

172172
#[derive(Clone, Debug)]
173-
#[deprecated(since="0.6.0", note="import with rand::prng::XorShiftRng instead")]
174-
pub struct XorShiftRng(prng::XorShiftRng);
173+
#[deprecated(since="0.6.0", note="import from rand_xorshift crate instead")]
174+
pub struct XorShiftRng(::rand_xorshift::XorShiftRng);
175175

176176
impl RngCore for XorShiftRng {
177177
#[inline(always)]
@@ -196,14 +196,14 @@ impl RngCore for XorShiftRng {
196196
}
197197

198198
impl SeedableRng for XorShiftRng {
199-
type Seed = <prng::XorShiftRng as SeedableRng>::Seed;
199+
type Seed = <::rand_xorshift::XorShiftRng as SeedableRng>::Seed;
200200

201201
fn from_seed(seed: Self::Seed) -> Self {
202-
XorShiftRng(prng::XorShiftRng::from_seed(seed))
202+
XorShiftRng(::rand_xorshift::XorShiftRng::from_seed(seed))
203203
}
204204

205205
fn from_rng<R: RngCore>(rng: R) -> Result<Self, Error> {
206-
prng::XorShiftRng::from_rng(rng).map(XorShiftRng)
206+
::rand_xorshift::XorShiftRng::from_rng(rng).map(XorShiftRng)
207207
}
208208
}
209209

src/prng/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,10 @@ pub mod hc128;
321321

322322
pub use self::chacha::ChaChaRng;
323323
pub use self::hc128::Hc128Rng;
324-
pub use ::rand_xorshift::XorShiftRng;
325324

326325
// Deprecations (to be removed in 0.7)
326+
#[doc(hidden)] #[allow(deprecated)]
327+
pub use deprecated::XorShiftRng;
327328
#[doc(hidden)] pub mod isaac {
328329
// Note: we miss `IsaacCore` here but probably unimportant.
329330
#[allow(deprecated)] pub use deprecated::IsaacRng;

src/rngs/small.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! A small fast RNG
1212
1313
use {RngCore, SeedableRng, Error};
14-
use prng::XorShiftRng;
14+
use ::rand_xorshift::XorShiftRng;
1515

1616
/// An RNG recommended when small state, cheap initialization and good
1717
/// performance are required. The PRNG algorithm in `SmallRng` is chosen to be

src/seq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ fn sample_indices_cache<R>(
598598
mod test {
599599
use super::*;
600600
#[cfg(feature = "alloc")] use {Rng, SeedableRng};
601-
#[cfg(feature = "alloc")] use prng::XorShiftRng;
601+
#[cfg(feature = "alloc")] use ::rand_xorshift::XorShiftRng;
602602
#[cfg(all(feature="alloc", not(feature="std")))]
603603
use alloc::vec::Vec;
604604

0 commit comments

Comments
 (0)