use rand::distributions::{Distribution, Standard}; use rand::Rng; use crate::duration::CalendarDuration; impl Distribution for Standard { fn sample(&self, rng: &mut R) -> CalendarDuration { let min = CalendarDuration::MIN.whole_months(); let max = CalendarDuration::MAX.whole_months(); CalendarDuration::months(rng.gen_range(min..=max)) } }