roll-dice

Crates.ioroll-dice
lib.rsroll-dice
version0.2.0
sourcesrc
created_at2020-03-05 17:38:17.358228
updated_at2020-09-23 17:43:19.224944
descriptionA library for rolling dice
homepage
repositoryhttps://github.com/avikuloff/dice-rs
max_upload_size
id215762
size5,792
Andrey Vikulov (avikuloff)

documentation

https://docs.rs/roll-dice

README

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

Commit count: 6

cargo fmt