On Friday, 26 February 2016 at 08:12:18 UTC, Joseph Rushton Wakeling wrote:
On Friday, 26 February 2016 at 08:05:09 UTC, Joseph Rushton Wakeling wrote:
On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote:
So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the array already covered.

Yes, this is definitely a standout in terms of being an unpleasant solution. It means that you require o(N) memory even when you're dealing with a lazily-evaluated range -- it would probably be more efficient in practice to just write the input into an array and do an in-place shuffle. :-(

Also: I don't have the access to determine if this is really on the money, but looks like it could be promising: http://www.sciencedirect.com/science/article/pii/S0020019098001276

Reply via email to