1 Random ran=new Random(); 2 int [] a=new int [8]; 3 for(int i=0;i<8;i++) 4 { 5 a[i]=ran.nextInt(35); 6 for(int j=0;j<i;j++) 7 {if(a[i]==a[j]) 8 { 9 i--; 10 break; 11 } 12 13 } 14 System.out.println(a[0]); 15 System.out.println(a[1]); 16 System.out.println(a[2]); 17 System.out.println(a[3]); 18 System.out.println(a[4]); 19 System.out.println(a[5]); 20 System.out.println(a[6]); 21 System.out.println(a[7]); 22 } 23
时间: 2024-10-19 19:38:39