Range primitives.
int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]; foreach (e; cover(a)) { writeln(e); } // using a specified random number generator auto gen = new Random(unpredictableSeed); foreach (e; cover(a, gen)) { writeln(e); }
The alias randomCover is available to ease migration for code written using $(PHOBOSXREF random, randomCover).
Covers a given range r in a random manner, i.e. goes through each element of r once and only once, but in a random order. r must be a random-access range with length.
If no random number generator is passed to cover, the thread-global RNG rndGen will be used as the source of randomness.