Crates.io | tomb |
lib.rs | tomb |
version | 0.2.0 |
source | src |
created_at | 2022-12-01 21:45:26.105554 |
updated_at | 2022-12-02 21:32:05.904936 |
description | A minimal crate that provides dice rolling mechanisms for games |
homepage | |
repository | https://github.com/matanlurey/grud |
max_upload_size | |
id | 727945 |
size | 42,003 |
Tomb is a minimal crate that provides dice rolling mechanisms for games.
// Creating and rolling a D20
// Optional dependency, exclude to implement your own RNG.
use fastrand::Rng;
// It is possible to define your own dice, rollers, and to use immutable die as well!
use tomb::{D20, RngRoller, RollMut};
// Pre-defined seed so the result of this example is predictable.
let roller = RngRoller::from(Rng::with_seed(7194422452970863838));
let mut d20 = D20::new();
roller.roll_mut(&mut d20);
assert_eq!(d20.value(), 10);