【ECMAScript】睡眠、数组洗牌
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
},
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
let tmp = array[i];
array[i] = array[j];
array[j] = tmp;
}
return array;
},