Returns a randomly shuffled copy of items without mutating the source array.
items
Array to copy and shuffle; the original is not modified.
A Fisher–Yates shuffled copy of items.
const items = [1, 2, 3, 4];const shuffled = randomShuffle(items);shuffled; // e.g. [3, 1, 4, 2]items; // [1, 2, 3, 4] (unchanged) Copy
const items = [1, 2, 3, 4];const shuffled = randomShuffle(items);shuffled; // e.g. [3, 1, 4, 2]items; // [1, 2, 3, 4] (unchanged)
Returns a randomly shuffled copy of
itemswithout mutating the source array.