亲,你不懂双色球的规则吧?
- package cn.ajun.Demo.www;
- import java.util.Set;
- import java.util.TreeSet;
- public class Demo {
- public static void main(String[] args) throws Exception {
- Set<Integer> s = new TreeSet<Integer>();
- while (true) {
- int num = (int) (Math.random() * 33 + 1);
- s.add(num);
- if (s.size()==6) {
- break;
- }
- }
- int num1 = (int) (Math.random() * 16 + 1);
- System.out.print("号码个数:"+s.size()+",红球"+ s + ",篮球:" + num1);
- }
- }
复制代码 |