Crate saikoro

Source
Expand description

A parser and evaluator for dice notation expression

§Basic Usage example

// roll for fireball damage
let damage = saikoro::evaluate("8d6")?;
println!("Fireball deals {} fire damage", damage.value);

Modules§

error
evaluation
Types used in the evaluation of dice expressions
operator
Types which represent operators

Traits§

RangeRng
A utility trait for allowing flexibility for testing or rigging saikoro’s random number generation. All implementers of rand::RngCore (i.e. all RNGs from the rand therefore ones one is likely to use) get an implementation of this trait for free, so most will not need to implement this trait, but it is availale publicly for those who do

Functions§

eval_with_rand
Evaluates a string in format similar to Standard Dice Notation evaluated with the given RangeRng
eval_with_seed
A utility wrapper function for seeding a dice roll with the given u64 as the seed (see saikoro::eval_with_rand for more information)
evaluate
Evaluates a string in format similar to Standard Dice Notation evaluated with rand::thread_rng. Equivalent to eval_with_rand called with &mut rand::thread_rng() as the second parameter