This commit is contained in:
lcj
2026-07-14 11:56:33 +08:00
parent 54750f6e3c
commit e4c29a08b4
167 changed files with 29581 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
// 打乱数组
function randomArray(array = []) {
// 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
return array.sort(() => Math.random() - 0.5);
}
export default randomArray