public static void main(String[] args) {
Set<Integer> set=new HashSet<Integer>();
while(set.size()<10) {
int randomInt=(int)(Math.random()*100+1);
set.add(randomInt);
}
System.out.println(set);
}
编写程序,生成10个1~100的不重复随机数
最新推荐文章于 2024-05-13 19:51:02 发布