int[] arr =new int[6]; for (int i=0;i<6;i++) { Random r= new Random(); arr[i]=r.nextInt(36)+1; for (int j=0;j<i;j++) { if(arr[i]==arr[j]) { i--; break; } } } System.out.print("中奖号码是:"); for(int a:arr) System.out.print(a+" ");
int[] arr =new int[6]; for (int i=0;i<6;i++) { Random r= new Random(); arr[i]=r.nextInt(36)+1; for (int j=0;j<i;j++) { if(arr[i]==arr[j]) { i--; break; } } } System.out.print("中奖号码是:"); for(int a:arr) System.out.print(a+" ");