package com.ruoyi.system.user.utils;

public class UserUtil {
    
    /**
     * 生成6位随机密码
     * @return 随机密码
     */
    public static String randomPassword() {
        // 定义密码字符集
        String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuilder password = new StringBuilder();
        // 生成6位随机密码
        for (int i = 0; i < 6; i++) {
            int index = (int) (Math.random() * chars.length());
            password.append(chars.charAt(index));
        }
        return password.toString();
    }
    
}
