Meta:
You need to use the function array from std.array.import std.array; int[] source = [ ... ]; int[] sample = randomSample(source, 3).array();
In some cases it's also useful to use std.algorithm.copy:
void main() {
import std.stdio, std.algorithm, std.random, std.array,
std.range;
immutable int[9] source = iota(10, 100, 10).array;
source.writeln;
int[3] sample;
source[].randomSample(sample.length).copy(sample[]);
sample.writeln;
}
Bye,
bearophile
