diff --git a/Cargo.toml b/Cargo.toml index 550b10f..36ef900 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "parity-wordlist" -version = "1.2.1" +version = "1.3.0" description = "Word list used to generate brain wallets for Parity." license = "GPL-3.0" authors = ["Parity Technologies "] @@ -8,5 +8,5 @@ repository = "https://github.com/paritytech/wordlist" [dependencies] lazy_static = "1.0" -rand = "0.5" +rand = "0.6" itertools = "0.5" diff --git a/src/lib.rs b/src/lib.rs index 71b3b06..fe87a79 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,7 +27,7 @@ extern crate rand; use std::fmt; use std::collections::HashSet; use itertools::Itertools; -use rand::{Rng, OsRng}; +use rand::{rngs::OsRng, seq::SliceRandom}; /// The list of dictionary words. // the wordlist JSON also happens to be valid Rust syntax for an array constant. @@ -40,7 +40,7 @@ pub const WORDS: &'static [&'static str] = &include!("../res/wordlist.json"); /// which is enough to saturate 32-byte key space pub fn random_phrase(no_of_words: usize) -> String { let mut rng = OsRng::new().expect("Not able to operate without random source."); - (0..no_of_words).map(|_| rng.choose(WORDS).unwrap()).join(" ") + (0..no_of_words).map(|_| WORDS.choose(&mut rng).unwrap()).join(" ") } /// Phrase Validation Error