//随机数 双色球 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);
原文地址:https://www.cnblogs.com/shenbo666/p/9456620.html
时间: 2024-10-11 22:47:05