var playList = ['1','2','3','4','5','6','7','8','9','10'];//定义数组
while(playList.length>0){
var temp = getPlay();
alert(temp);
}
function getPlay(){
for(var i=0;i<playList.length;i++){
var pos = Math.floor(Math.random()*playList.length);
var tp = playList[pos];
playList.splice(pos, 1);//抽取出来了就删除掉
return tp;
}
}
while(playList.length>0){
var temp = getPlay();
alert(temp);
}
function getPlay(){
for(var i=0;i<playList.length;i++){
var pos = Math.floor(Math.random()*playList.length);
var tp = playList[pos];
playList.splice(pos, 1);//抽取出来了就删除掉
return tp;
}
}