Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[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 <admin@parity.io>"]
repository = "https://github.com/paritytech/wordlist"

[dependencies]
lazy_static = "1.0"
rand = "0.5"
rand = "0.6"
itertools = "0.5"
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down