/// Rolls the dice, returning a random value for each dice.
Rolls the dice, returning a random value for each dice.
Rolls the dice returning a random value for each dice .
pub fn roll(&self) -> Vec<i32> {
        match self {
            DiceTerm::Dice { count, sides } => {
                let max_value = (sides+1).try_into().unwrap();
                (0..(*count).abs())
                    .map(|_| rand::thread_rng().gen_range(1, max_value))
                    .map(|x| x * count.signum())
                    .collect::<Vec<i32>>()
            }
            DiceTerm::Constant(constant) => vec![*constant]
        }
    }
pub fn roll ( & self ) -> Vec < i32 > { match self { DiceTerm :: Dice { count , sides } => { let max_value = ( sides + 1 ) . try_into ( ) . unwrap ( ) ; ( 0 .. ( * count ) . abs ( ) ) . map ( | _ | rand :: thread_rng ( ) . gen_range ( 1 , max_value ) ) . map ( | x | x * count . signum ( ) ) . collect :: < Vec < i32 > > ( ) } DiceTerm :: Constant ( constant ) => vec ! [ constant ] } }
Rolls the dice, returning a random value for each dice.
Rolls the dice returning a random value for each dice .
&self