Array shuffling, randomly rearranging the order of elements in an array
数组洗牌,随机打乱数组中的顺序
The type of elements in the array / 数组元素的类型
The array to shuffle / 要洗牌的数组
The shuffled array (same reference as input) / 洗牌后的数组(与输入为同一引用)
This function mutates the original array and returns it. If you need to preserve the original array, pass a copy: shuffle([...arr]).
shuffle([...arr])
此函数会修改原数组并返回它。 如果需要保留原数组,请传入副本:shuffle([...arr])。
shuffle([1, 2, 3]) // => [1, 3, 2] Copy
shuffle([1, 2, 3]) // => [1, 3, 2]
Array shuffling, randomly rearranging the order of elements in an array
数组洗牌,随机打乱数组中的顺序