tongchuan

Results 2 comments of tongchuan

let arr = Array.from({length:10000},(v,i)=>i+1) //创建一个数组 let arr2 = Array.from({length:100}) // 要获取的随机数组 arr2 = arr2.map((i)=>{ return arr.splice(parseInt(Math.random()*arr.length),1) //返回随机数,并去除已经放到随机数中的数 }) console.log(arr2) //打印结构