public class Test {
public static void main(String[] args) {
HashSet<Integer> set = new HashSet<>();
Random random = new Random();
int count = 0;
while (set.size() < 10) {
int i = random.nextInt(90) + 10;
System.out.println(count++ + "随机得到的数" + i);
set.add(i);
}
Iterator<Integer> it = set.iterator();
while (it.hasNext()) {
int i = it.next();
System.out.println(i);
}
System.out.println("已经放进去了" + set.size());
}
}