public static void main(String[] args) {
n(50,4);
}
public static void n(int y,int type){
Random e1 = new Random();
char[] a1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+~:/'][=,-./。,;‘】【】".toCharArray();
switch (type){
case 1:
String passward1 = "";
for (int i = 0;i<y;i++){
passward1 += a1[e1.nextInt(27)];
}
System.out.println(passward1);
break;
case 2:
String passward2 = "";
for (int i = 0;i<y;i++){
passward2 += a1[e1.nextInt(53)];
}
System.out.println(passward2);
break;
case 3:
String passward3 = "";
for (int i = 0;i<y;i++){
passward3 += a1[e1.nextInt(62)];
}
System.out.println(passward3);
break;
case 4:
String passward4 = "";
for (int i = 0;i<y;i++){
passward4 += a1[e1.nextInt(a1.length)];
}
System.out.println(passward4);
break;
default:
String passward5 = "";
for (int i = 0;i<y;i++){
passward5 += e1.nextInt(0,10);
}
System.out.println(passward5);
break;
}
}
随机生成密码
最新推荐文章于 2024-11-04 22:26:34 发布