Best shuffle: Difference between revisions

Content added Content deleted
(Undo revision 144122 by Fwend (talk))
Line 1,057: Line 1,057:


auto bestShuffle(S)(in S orig) if (isSomeString!S) {
auto bestShuffle(S)(in S orig) if (isSomeString!S) {
static if (isNarrowString!S)
auto s = to!(dchar[])(o);
auto o = to!dstring(orig);
else alias orig o;

auto s = o.dup;
randomShuffle(s);
randomShuffle(s);
foreach (i, ref ci; s) {
foreach (i, ref ci; s) {