public class NumRandom {
public static void main(String[] args) {
Set set = new HashSet<>();
Random random = new Random();
while(true){
int num = random.nextInt(100);
set.add(num);
//判断集合个数
if (set.size() == 10){
break;
}
}
System.out.println(set);
}
}



