diff --git a/Cargo.toml b/Cargo.toml index c2fac9c..71d06a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] num = "0.1.28" -rand = "0.3.12" +rand = "0.8.5" serde = { optional = true, version = "1.0.*", features = ["derive"] } [dev-dependencies] diff --git a/src/letter.rs b/src/letter.rs index e822f3b..0d6c7ba 100644 --- a/src/letter.rs +++ b/src/letter.rs @@ -2,6 +2,10 @@ use self::Letter::{Ab, Ash, Bb, Csh, Db, Dsh, Eb, Fsh, Gb, Gsh, A, B, C, D, E, F use crate::utils::modulo; use num::PrimInt as Int; use num::{FromPrimitive, ToPrimitive}; +use rand::{ + distributions::Distribution, + Rng, +}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::cmp::Ordering; @@ -136,9 +140,9 @@ impl ToPrimitive for Letter { } } -impl ::rand::Rand for Letter { - fn rand(rng: &mut R) -> Letter { - rng.gen_range(0, 12).to_letter() +impl Distribution for Letter { + fn sample(&self, rng: &mut R) -> Letter { + rng.gen_range(0..12).to_letter() } }