双色球的随机

//随机数  双色球

var compare = function (x, y) {//比较函数
if (x < y) {
return -1;
} else if (x > y) {
return 1;
} else {
return 0;
}
}

num1 = Math.floor(Math.random() * 32)+1;
num2 = Math.floor(Math.random() * 32)+1;
num3 = Math.floor(Math.random() * 32)+1;
num4 = Math.floor(Math.random() * 32)+1;
num5 = Math.floor(Math.random() * 32)+1;
num6 = Math.floor(Math.random() * 32)+1;
num7 = Math.floor(Math.random() * 16)+1;

var arr = [num1, num2, num3, num4, num5, num6];

arr.sort(compare);
console.log(arr,num7);
posted @ 2018-08-10 18:00  小猴子会上树  阅读(196)  评论(0编辑  收藏  举报