shuffle(resource) {
// 防止影响原数组
const arr = resource.slice()
for (let i = 0; i < arr.length; i++) {
this.swap(arr, i, this.getRandomInt(i))
}
return arr
},
// 获取一个随机整数
getRandomInt(max) {
return Math.floor(Math.random() * (max))
},
swap(arr, i, j) {
const temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
},