random-constructible 0.11.0

Provides a trait for creating random instances of enums with weighted probabilities
Documentation
// ---------------- [ File: random-constructible/src/rand_construct.rs ]
crate::ix!();

pub trait RandConstruct {
    fn random() -> Self;
    fn uniform() -> Self;
    fn random_with_rng<R: Rng + ?Sized>(rng: &mut R) -> Self;
}

impl<E: RandConstructEnum> RandConstruct for E {

    fn random() -> Self {
        <Self as RandConstructEnum>::random_variant()
    }

    fn uniform() -> Self {
        <Self as RandConstructEnum>::uniform_variant()
    }

    fn random_with_rng<R: Rng + ?Sized>(rng: &mut R) -> Self {
        <Self as RandConstructEnum>::random_enum_value_with_rng(rng)
    }
}