Sort in return statement

codephantom me at noyb.com
Sat Dec 9 14:42:44 UTC 2017


On Saturday, 9 December 2017 at 14:18:00 UTC, Seb wrote:
>
> Yeah, you are very welcome. It's a bit hidden in the docs:
>

Yes. Thanks for that.

After lots of reading, and testing, I managed to get a simple, 
one liner ;-)
(doesn't seem like .release is needed though.)

// -----------
auto draw8Numbers()
{
     import std.meta : aliasSeqOf;
     import std.range : iota;
     import std.random : randomSample;

     return randomSample([ aliasSeqOf!(iota(1,46)) ], 8);
}
// -----------




More information about the Digitalmars-d-learn mailing list