[Issue 9106] Rename std.random.randomShuffle as std.random.shuffle and small usage change

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 23 07:59:52 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=9106



--- Comment #14 from Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> 2014-03-23 07:59:45 PDT ---
(In reply to comment #12)
> No, I didn't see a similar function in other languages.  The function itself
> seems a bit odd to me, even after I got an explanation of a possible use case
> (in this old thread:
> http://forum.dlang.org/thread/kuvhrfnrrbhzpyoirqgt@forum.dlang.org#post-kuvhrfnrrbhzpyoirqgt:40forum.dlang.org).

The rationale that I can see for randomCover would be that it ought to provide
a non-destructive (i.e. no in-place shuffling), non-allocating (i.e. no
.dup-ing or .save-ing of the original range) way of getting a random
permutation of the elements of the range provided as input.

However, currently randomCover fails on the second of these in any case,
because it contains and allocates an internal array of bools, _chosen.

I think that to be honest we simply need to do research and identify a better
algorithm than the one currently implemented.  One such must exist.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list