March 29, 2014 [Issue 4851] Three suggestions for std.random | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=4851 --- Comment #7 from bearophile_hugs@eml.cc 2014-03-29 16:13:21 PDT --- If choice returns a reference you can do: void knuthShuffle(T)(T[] r) { foreach_reverse (immutable i, ref ri; r[1 .. $ - 1]) r[0 .. i + 1].choice.swap(ri); } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation