JAVA版彩票随机生成系统

作者在 2007-06-11 00:00:00 发布以下内容

原帖及讨论:http://bbs.bc-cn.net/dispbbs.asp?boardid=5&id=108910

import java.io.*;
import java.util.Random;

class num
{
    public static void main(String[]args)
    {
        //声明一个随机数组
        int sjsh[]=new int[7];
        int sum;
        try
        {
            InputStreamReader a=new InputStreamReader(System.in);
            BufferedReader b=new BufferedReader(a);
            System.out.println ("欢迎使用齐鲁风采30选7彩票随机系统!");
            System.out.print ("请选择投注数:");
            String s=b.readLine();
            int sh=Integer.parseInt(s);
            //给随机数组赋随机值 且 保证没有重复
            for (int i = 0; i<sh; i++)
            {
                for (int j = 0; j<7; j++)
                {
                    Random rnd = new Random();
                    sjsh[j] = rnd.nextInt(31);
                    switch(j)
                    {
                        case 0:;break;
                        case 1:
                        {
                        if(sjsh[j]==sjsh[j-1])
                        j--;
                        };break;
                        case 2:
                        {
                        if(sjsh[j]==sjsh[j-1]||sjsh[j]==sjsh[j-2])
                        j--;
                 &n

J2EE | 阅读 2593 次
文章评论,共0条
游客请输入验证码
浏览255315次