1 public static void main(String[] args) 2 { 3 //36选7 4 int[] caiPiao = new int[7]; 5 Random rand = new Random(); 6 7 //生成 8 for(int i=0;i<7;i++) //生成7个随机数。i代表正在生成第几个数 9 {10 int temp = rand.nextInt(36); 11 temp++; //生成随机数12 //解决重复问题13 int chongFuCiShu = 0; //检索数组,记录重复次数14 for(int j=0;j<7;j++){ //检查是否有重复,有重复就记录chongFuCiShu++;15 if(temp == caiPiao[j]){16 chongFuCiShu++;17 }18 }19 20 if(chongFuCiShu == 0){21 caiPiao[i]=temp;22 }23 else{24 i--;25 }26 //System.out.print(temp+"\t");27 28 }29 //显示30 for(int i=0;i