https://d.puremagic.com/issues/show_bug.cgi?id=11738
Summary: partialShuffle actually shuffles the entire input Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: joseph.wakel...@webdrake.net --- Comment #0 from Joseph Rushton Wakeling <joseph.wakel...@webdrake.net> 2013-12-14 02:30:43 PST --- Created an attachment (id=1301) Test case to illustrate the bug. partialShuffle(input, n) is supposed to shuffle input[0 .. n] and leave input[n .. $] untouched. In fact it shuffles the entire input. This is illustrated by the attached code, where the second half of the partially shuffled array should still read 5, 6, 7, 8, 9 but is actually randomly rearranged. It's trivially fixable: on std/random.d:L1480 the second argument to uniform() should be n - i, not r.length - i. A copy-paste error from an earlier iteration of randomShuffle, perhaps? :-) -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------