use crate::prelude::*;
pub fn bool() -> impl Die<bool> {
dice::one_of().two(false, true)
}
pub fn weighted_bool(false_weight: u32, true_weight: u32) -> impl Die<bool> {
dice::weighted_one_of().two((false_weight, false), (true_weight, true))
}
#[cfg(test)]
mod tests {
use crate::prelude::*;
#[test]
fn bool_calc_stats() {
Dicetest::repeatedly()
.passes(0)
.stats_enabled(true)
.run(|mut fate| {
stat!("bool()", "{}", fate.roll(dice::bool()));
})
}
#[test]
fn weighted_bool_calc_stats() {
Dicetest::repeatedly()
.passes(0)
.stats_enabled(true)
.run(|mut fate| {
stat!(
"weighted_bool(1, 2)",
"{}",
fate.roll(dice::weighted_bool(1, 2)),
);
stat!(
"weighted_bool(10, 1)",
"{}",
fate.roll(dice::weighted_bool(9, 1)),
);
})
}
}