Function dicenotation::roll_dice
[−]
[src]
pub fn roll_dice<T>(notation: &str) -> Result<T, &str> where
T: PrimInt + FromStr + SampleRange,
<T as FromStr>::Err: Debug,
Execute a dice roll based on the given notation
Examples
Gets the result of rolling 3 die of 5 faces
use dicenotation::roll_dice; let result = roll_dice::<i32>("3d5");
Executes two rolls by summing their values
use dicenotation::roll_dice; let result = roll_dice::<i32>("3d5").unwrap() + roll_dice::<i32>("2d3").unwrap();