Yann:
Is there a better way to accomplish this? Naively, I would expect something like"return iota(1, 1000).randomShuffle.take(10).sort;"
Two ways, the first gives items in random order, the second ordered as you seem to desire:
import std.stdio, std.random, std.range, std.array;
void main() {
iota(1, 1001).randomCover(rndGen).take(10).writeln;
iota(1, 1001).randomSample(10).writeln;
}
But be careful with randomCover, because maybe it takes the rnd
generator by value.
Bye, bearophile
