function randomNum(iAll, iNow){
var arr = [];
var nArr = [];
for(var i = 1;i <= iAll; i++){
arr.push(i);
}
for(var i = 0; i< iNow; i++){
nArr.push(arr.splice(Math.floor(Math.random()*arr.length),1));
}
return nArr;
}
时间: 2024-11-01 08:30:59