use rand::seq::SliceRandom;

extern crate phf;

// build.rs produces a codegen.rs file defining WORDLIST:
// static WORDLIST: phf::Map<&str,&str>
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));

pub fn get_word(roll: &str) -> Option<String> {
    WORDLIST.get(roll).map(|s| s.to_string())
}

pub fn roll() -> String {
    let mut results = Vec::<&str>::with_capacity(5);
    let mut rng = rand::thread_rng();
    let choices = vec!["1", "2", "3", "4", "5", "6"];
    results.push(choices.choose(&mut rng).unwrap());
    results.push(choices.choose(&mut rng).unwrap());
    results.push(choices.choose(&mut rng).unwrap());
    results.push(choices.choose(&mut rng).unwrap());
    results.push(choices.choose(&mut rng).unwrap());
    let result = results.join("").to_string();
    result
}

use rand::Rng;

extern crate phf;

// build.rs produces a codegen.rs file defining WORDLIST:
// static WORDLIST: phf::Map<&str,&str>
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));

pub fn get_word(roll: &str) -> Option<String> {
    WORDLIST.get(roll).map(|s| s.to_string())
}

pub fn roll() -> String {
    let mut rng = rand::thread_rng();
    let mut results = Vec::<String>::with_capacity(5);
    for _ in 0..5 {
        let r = rng.gen_range(1, 7);
        results.push(r.to_string())
    }
    let result = results.join("");
    result
}

Adjust RNG style of rolls.
Adjust RNG style of rolls.
