2 unstable releases

0.2.0 Sep 23, 2020
0.1.0 Mar 5, 2020

#12 in #die

25 downloads per month

MIT license

5KB
81 lines

dice-rs

Very simple library for rolling dice.

Installation

Add this to your Cargo.toml

[dependencies]
roll-dice = "0.2"

Usage

Roll 3d6 (3 six-sided die) and get sum of the results

let rolled = roll(3, NonZeroU32::new(6).unwrap());
let sum: u32 = rolled.iter().sum();

Roll one d20

let d20 = Die::new(NonZeroU32::new(20).unwrap());

d20.roll();

License

MIT license

Dependencies

~1.4–2.1MB
~38K SLoC