package com.smppw.utils;

import java.util.Random;

/**
 * @author Rain
 * @date 2023/2/22 20:18
 * @description
 */
public abstract class AbsPasswordUtils {


    //随机密码生成
    public static String generateRandomPassword(int len) {

        char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*.?".toCharArray();
        StringBuilder sb = new StringBuilder();
        Random r = new Random();

        for (int x = 0; x < len; ++x) {
            sb.append(chars[r.nextInt(chars.length)]);
        }
        return sb.toString();

    }
}
