/* * Creation : 29 Feb 2016 */ package cn.newtouch.doubleball; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; /** * The Class GetDoubleBall. */ public class GetDoubleBall { /** The Constant RESULT_COUNT. */ private static final int RESULT_COUNT = 8; /** The result. */ private static Set<Integer> result = new HashSet<Integer>(); // (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, // 21, 22, 23,24, 25, 26, 27, 28, 29, 30, 31, 32, 33) /** The Constant redExistList. */ public static final List<Integer> redExistList = Arrays.asList(1, 2, 3, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 27, 28, 29); /** * The main method. * * @param args * the arguments */ public static void main(String[] args) { result.add(10); while (result.size() < RESULT_COUNT) { Integer temp = getRandLt33(); if (redExistList.contains(temp)) { result.add(temp); } } System.out.println(result.toString()); } /** * Gets the rand lt33. * * @return the rand lt33 */ public static int getRandLt33() { return 1 + (int) (Math.random() * 33); } }
随机双色球
猜你喜欢
转载自lihongtai.iteye.com/blog/2280142
今日推荐
周排行