random number engine to use
random-access range whose elements are to be shuffled Complexity: O(range.length)
// mir.ndslice package is required, it can be found in 'mir-algorithm' static if (is(typeof({ import mir.ndslice.slice; }))) { import mir.ndslice.allocation: slice; import mir.ndslice.topology: iota; import mir.ndslice.sorting; auto a = iota(10).slice; shuffle(a); sort(a); assert(a == iota(10)); }
// mir.ndslice package is required, it can be found in 'mir-algorithm' static if (is(typeof({ import mir.ndslice.slice; }))) { import mir.ndslice.slice: sliced; import mir.ndslice.sorting; auto a = [1, 2, 3, 4]; a.sliced.shuffle; sort(a); assert(a == [1, 2, 3, 4]); }
Shuffles elements of range.