存储十个不相同的随机数

var roundArr:Array = [];
var roundInt:int;
while (roundArr.length<10) {
    roundInt = Math.random() * 10;
    if (roundArr.indexOf(roundInt) == -1) {
        roundArr.push(roundInt);
    }
}

 

posted on 2018-04-12 15:25  zqiang0803  阅读(118)  评论(0编辑  收藏  举报

导航