有三组数字 
A组 1,4,8,11,15,18
B组 2,5,9,12,13,16
C组 3,6,7,10,14,17
然后从每一组里面取出一个数 组成一组号码 例如 1 2 3  又例如1,5,7
A组和B组的号码可以互换 而C组不能互换 
我的办法是通过将这些数字放到RANDOM里面随机 但是JAVA的伪随机码我不知道他的规律是什么 所以好像还是要自己写一个有规律而且又不能让人看出来 这其中规律的 好比第一次出现了123 那么在1000次之后在重新回到123这个数都可以 但是最起码不能第一次123 第10次又回来123这个数字排列上。

解决方案 »

  1.   

    你还是用java的随机数吧,弄一个hashtable,每次随机产生一个组合就往里放,一直等放到1000个。这时候hashtable中存在1000各不重复的组合,然后你把这些组合全部放到list中,重复遍历这个list中不就是你要的随机且有规律吗?
      

  2.   

    这个链接里问题的答案可以作为本帖问题的先导
    http://topic.csdn.net/u/20090814/01/bc7b70ff-d6ca-409f-bde1-cc89515ceb3b.html借用下里面的方法应该可以满足需求public class Test {
    public static void main(String[] args) {
    int[] a={1,4,8,11,15,18};
    int[] b={2,5,9,12,13,16};
    int[] c={3,6,7,10,14,17};
    for(int i=0;i<100;i++){
    int num=nextInt(i);
    System.out.println(a[num/100%6]+","+b[(num/10)%10%6]+","+c[num%10%6]);
    }
    }
    //以下方法作者为bigbug9002
    private static int nextInt(int index){
            if(index<0){
                throw new IllegalArgumentException("num must be positive number."); 
            }
            double x=Math.abs(Math.cos(Math.sqrt(2)*(index+1)));
            double y=1.0*137/13/(index+1);
            double z=17*index*index+29*index+67;
            y=y-(int)y;
            while(y*10<1) y*=10;
            while(z>1) z/=7;
            x=x*z+y;
            String str=String.valueOf(x);
            str=str.substring(2);
            int start=index%13;
            return Integer.parseInt(str.substring(start,start+3));    
        }
    }