function shuffle(array) {
let res = [], random;
while (array.length > 0) {
random = Math.floor(Math.random() * array.length);
res.push(array[random]);
array.splice(random, 1);
}
return res;
}
JS的随机排序(洗牌法)
最新推荐文章于 2023-06-01 11:24:58 发布