roll-dice 0.2.0

A library for rolling dice
Documentation
  • Coverage
  • 66.67%
    4 out of 6 items documented1 out of 5 items with examples
  • Size
  • Source code size: 5.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.55 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 22s Average build duration of successful builds.
  • all releases: 22s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • avikuloff/dice-rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • avikuloff

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