public class code {
public static void main(String[] args) {
System.out.println(creatcode(6));
System.out.println(creatcode(10));
}
public static String creatcode(int n){
Random r = new Random();
String code = "";
String data = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
for (int i = 0; i < n; i++) {
int index = r.nextInt(data.length());
code += data.charAt(index);
}
return code;
}
}
随机生成验证码(二)
最新推荐文章于 2024-10-30 18:07:32 发布