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.

Constructors

this
this(UniformRNG rng)
Undocumented in source.
this
this(typeof(this) that)
Undocumented in source.

Members

Functions

front
E front()
popFront
void popFront()
save
typeof(this) save()

Range primitives.

Variables

empty
enum bool empty;

Range primitives.

isRandomDistribution
enum bool isRandomDistribution;
Undocumented in source.
max
enum E max;
Undocumented in source.
min
enum E min;
Undocumented in source.

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