flowerRandom(arr, count,cb){
var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
while (i-- > min) {
index = Math.floor((i + 1) * Math.random());
temp = shuffled[index];
shuffled[index] = shuffled[i];
shuffled[i] = temp;
}
cb(shuffled.slice(min));
}```
独特的数组乱序算法
最新推荐文章于 2023-09-07 22:59:16 发布