dicebag

Crates.iodicebag
lib.rsdicebag
version0.2.1
sourcesrc
created_at2024-08-28 15:01:14.805583
updated_at2024-09-01 02:38:54.740367
descriptionDice rolling!
homepage
repository
max_upload_size
id1354757
size5,919
Markku Sukanen (msukanen)

documentation

README

Dicebag

This library contains various "dice rolling" functions and traits.

dicebag::DiceExt

Dice rolling is currently implemented only for i32.

Usage

// 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);
Commit count: 0

cargo fmt