import java.io.*;
public class AuthCode{
public static void main(String[] args){
char[] characters={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','0'};
char[] fourResult=new char[4];
int index;
for (int k=0;k<4;k++ ){
index=(int)(Math.random()*62);
fourResult[k]=characters[index];
}
for(int i=0;i<4;i++)
System.out.println(fourResult[i]);
}
}
结果是随机的四个数字或字母组合:
edio
aB09
posted on 2009-11-02 00:16
期待明天 阅读(266)
评论(0) 编辑 收藏 所属分类:
Java