<script>
  const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  function shuffleArray(array) {
    for (let i = array.length - 1; i > 0; i--) {
      const j = Math.floor(Math.random() * (i + 1));
      [array[i], array[j]] = [array[j], array[i]];
    }
    return array;
  }
  const shuffledArr = shuffleArray(arr);
  console.log(shuffledArr);
</script>
将代码const arr = 1 2 3 4 5 6 7 8 9 10;这个数组随机打乱排序请生成js源码并存放在script中

原文地址: http://www.cveoy.top/t/topic/bd4n 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录