| Crates.io | dicebag |
| lib.rs | dicebag |
| version | 0.3.0 |
| created_at | 2024-08-28 15:01:14.805583+00 |
| updated_at | 2025-07-05 22:49:18.558916+00 |
| description | Dice rolling! |
| homepage | |
| repository | https://github.com/msukanen/dice.git |
| max_upload_size | |
| id | 1354757 |
| size | 14,264 |
This library contains various "dice rolling" functions and traits.
Dice rolling is currently implemented for most basic numeric types from i8 to i128, u8 to u128, and usize.
// Some normie dice:
let a = 3.d6(); // 3d6
let b = 10.d10(); // 10d10
// Delta variancy:
let d = 1.0.delta(5);
→ 1.0 ± 5%
→ 0.95 .. 1.05
// 50% chance of `c` becoming 5 (otherwise 0).
let c = chance_of!(5, 50);