On 5/17/2014 9:18 PM, David Held wrote:
How do I get an array from randomSample()?

int[] source = [ ... ];
int[] sample = randomSample(source, 3);

src\main.d(30): Error: cannot implicitly convert expression
(randomSample(source, 3u)) of type RandomSample!(int[], void) to int[]
[...]

Even worse, foreach is brittle:

    foreach (i, a; randomSample(source, 3))

src\main.d(30): Error: cannot infer argument types

If I remove the index variable, it works.  But I really need the index too.

Dave

Reply via email to