bracket-random 0.8.7

Random number generator (xorshift based), focused on dice rolling. Optionally includes parsing of RPG-style dice strings (e.g. "3d6+12"). Part of the bracket-lib family.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use bracket_random::prelude::*;

fn main() {
    let options = ["Cat", "Dog", "Gerbil", "Hamster", "Dragon"];

    let mut rng = RandomNumberGenerator::new();
    for _ in 0..10 {
        let option = rng.random_slice_index(&options).unwrap();
        println!(
            "Randomly chose index: {}, which is a {}",
            option, options[option]
        );
    }
}