在这个小代码中支持密码长度的自选
import java.util.Random;
import java.util.Scanner;
// 在本文件中利用随机数+ASCII值码来实现Authentication_Code
// Random rand=new Random(); 生成0-1.0的小数
// rand.nextInt(10); 0-9的小数
// >> +48; 生成48-57
// rand.nextInt(27) 0-26
// >> +65; 生成65-91
// >> +97; 生成97-122
// 48-57为数字0-9 Math.random
// 65-90为大写26字母
// 97-122 为小写字母
// 随机数在范围外的直接舍弃并重新生成随机数
// 将生成的数以数组的方式随机填充到数组的位置
public class RadomPassCode {
public static void main(String[] args) {
System.out.print("您想要生成多少位的 Authentication_Code 呢:");
Scanner sc=new Scanner(System.in);
int length= sc.nextInt();
System.out.println("已经为您生成了以下五种高安全密钥:");
for (int i=0;i<5;i++){
Authentication_Code(length);
}
}
public static void Authentication_Code(int length){
Random rand=new Random();
char[] stringInt=new char[length];
for(int i=0;i


