Best shuffle: Difference between revisions

(→‎{{header|D}}: more concise)
Line 634:
auto s = o.dup;
randomShuffle(s);
foreach (i, ref ci; s)
foreach (j, ref cj; s)
if (ici != jcj && ci != o[j] && cj != o[i]) {
swap(ci, cj);
break;
Anonymous user