package day14;
import java.util.Arrays;
import java.util.Random;
public class Demo01 {
public static void main(String[] args) {
int[] balls = gen();
System.out.println(Arrays.toString(balls));
}
public static int[] gen() {
int[] pool = new int[34];
for (int i = 1; i
pool[i - 1] = i;
}
boolean[] used = new boolean[pool.length];
int[] balls = new int[6];
int index = 0;
Random random = new Random();
int i;
do {
i = random.nextInt(pool.length);
if (used[i])
continue;
balls[index++] = pool[i];
used[i] = true;
} while (index != balls.length);
Arrays.sort(balls);
balls = Arrays.copyOf(balls, balls.length + 1);
balls[balls.length - 1] = pool[random.nextInt(16)];
return balls;
}
}