public static void main(String[] args) {
System.out.print("红色的号码为:");
Set<Integer> set=new HashSet<Integer>();
while (true) {
int i=(int)(Math.random()*33+1);
set.add(i);
if (set.size()>=6) {
break;
}
}
for (Object object:set) {
System.out.print(object+"\t");
}
System.out.print("蓝色的号码为:");
for (int j = 0; j < 1; j++) {
int blue=(int)(Math.random()*16+1);
System.out.println(blue+"\t");
}
}
Java编程:实现双色球彩票生成器,生成不重复随机数,布布扣,bubuko.com
原文:http://www.cnblogs.com/Miss-Lee/p/3791708.html