1 struct NoRng 2 { 3 @property uint front() {return 0;} 4 @property bool empty() {return false;} 5 void popFront() {} 6 } 7 static assert(!isUniformRNG!(NoRng)); 8 9 struct validRng 10 { 11 @property uint front() {return 0;} 12 @property bool empty() {return false;} 13 void popFront() {} 14 15 enum isUniformRandom = true; 16 } 17 static assert(isUniformRNG!(validRng, uint)); 18 static assert(isUniformRNG!(validRng));
Test if Rng is a random-number generator. The overload taking a ElementType also makes sure that the Rng generates values of that type.
A random-number generator has at least the following features: