You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
1234567
  1. // 打乱数组
  2. function randomArray(array = []) {
  3. // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
  4. return array.sort(() => Math.random() - 0.5);
  5. }
  6. export default randomArray