Skip to content

Commit bf9940e

Browse files
committed
Update dependencies to just use rand_core 0.6
1 parent ea679fa commit bf9940e

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ documentation = "https://docs.rs/mt19937"
99
repository = "https://github.com/RustPython/mt19937"
1010

1111
[dependencies]
12-
rand_core = "0.5"
13-
rand = "0.7"
12+
rand_core = "0.6"

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ impl MT19937 {
224224
/// Original mt19937ar.c attribution:
225225
///
226226
/** These real versions are due to Isaku Wada, 2002/01/09 added */
227-
pub fn gen_res53<R: rand::RngCore>(rng: &mut R) -> f64 {
227+
pub fn gen_res53<R: rand_core::RngCore>(rng: &mut R) -> f64 {
228228
let a = rng.next_u32() >> 5;
229229
let b = rng.next_u32() >> 6;
230230
(a as f64 * 67108864.0 + b as f64) * (1.0 / 9007199254740992.0)
231231
}
232232

233-
impl rand::RngCore for MT19937 {
233+
impl rand_core::RngCore for MT19937 {
234234
fn next_u32(&mut self) -> u32 {
235235
self.gen_u32()
236236
}
@@ -240,13 +240,13 @@ impl rand::RngCore for MT19937 {
240240
fn fill_bytes(&mut self, dest: &mut [u8]) {
241241
rand_core::impls::fill_bytes_via_next(self, dest)
242242
}
243-
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand::Error> {
243+
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {
244244
self.fill_bytes(dest);
245245
Ok(())
246246
}
247247
}
248248

249-
/// Seed for <MT19937 as rand::SeedableRng>
249+
/// Seed for <MT19937 as rand_core::SeedableRng>
250250
///
251251
/// Very big seed, but this is the size that CPython uses as well
252252
pub struct Seed(pub [u32; N]);
@@ -262,7 +262,7 @@ impl AsMut<[u8]> for Seed {
262262
unsafe { self.0.align_to_mut().1 }
263263
}
264264
}
265-
impl rand::SeedableRng for MT19937 {
265+
impl rand_core::SeedableRng for MT19937 {
266266
type Seed = Seed;
267267
fn from_seed(seed: Self::Seed) -> Self {
268268
Self::new_with_slice_seed(&seed.0)

0 commit comments

Comments
 (0)