Skip to main content

常用函数

随机排序

export const randomArr = (arr = []) => {
const optArr = [...arr];
const res = [];
while (optArr.length) {
const randomIndex = Math.floor(Math.random() * optArr.length);
res.push(optArr[randomIndex]);
optArr.splice(randomIndex, 1);
}
return res;
};

矩阵