java,php,asp.net,linux,javascript,mysql,mssql,oracle,编程

双色球算号器

转载请注明:http://www.pmjava.com/Article/ShowInfo.asp?ID=56610
 public class GenTicket {

   
/**
     *
     * 双色球算号器
    
*/
   
public static void main(String[] args) throws IOException {
        System.out.print(
"Input your lucky number: ");
        BufferedReader in
= new BufferedReader(new InputStreamReader(System.in));
       
int i = Integer.parseInt(in.readLine());
        Random random
= new Random(i);
        Set set
= new HashSet();
       
while(set.size() < 6) {
           
int num = Math.abs(random.nextInt() % 33) + 1;
            set.add(
new Integer(num));
        }
       
int blue = Math.abs(random.nextInt() % 16) + 1;
        System.out.print(
"red: ");
        Iterator red
= set.iterator();
       
while(red.hasNext())
            System.out.print(red.next()
+ " ");
        System.out.println(
'\n' + "blue: " + blue);
       
    }

}

posted on 2009-06-10 21:42 rrong_m 阅读(282) 评论(0)  编辑  收藏

<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

导航

统计

常用链接

随笔档案

文章分类

文章档案

java编程

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜