1 2 3 4 5 6 7 8 9 10 11 12 13 14
#[derive(Debug, Clone, Copy)] pub enum RandomType { Uniform, Fixed(f64) } impl RandomType { pub fn random(&self) -> f64 { match self { RandomType::Uniform => rand::random::<f64>(), RandomType::Fixed(value) => *value } } }