java生成10个不相等的1-20的随机数
2020-12-13 04:19
标签:随机 exti count and dom set rgs ati oid java生成10个不相等的1-20的随机数 标签:随机 exti count and dom set rgs ati oid 原文地址:https://www.cnblogs.com/Mr-nie/p/11107855.htmlpublic class Test {
public static void main(String[] args){
Random ran = new Random();
Set
while(set.size()==10?false:true){
int num = ran.nextInt(20)+1;
set.add(num);
}
Iterator
int count = 0;
while(it.hasNext()){
System.out.println("第"+ ++count +"个随机数 =="+it.next());
}
}
}
上一篇:统计两个数组中相同元素的个数