uniformDistribution

Generates an infinite sequence of uniformly selected members of enum E. If no random number generator is specified, the default rndGen will be used as the source of randomness.

Examples

enum Fruit { Apple = 12, Mango = 29, Pear = 72 }

foreach (immutable f; uniformDistribution!Fruit().take(100))
{
    assert(f == Fruit.Apple || f == Fruit.Mango || f == Fruit.Pear);
}

Meta