package com.jiayue.ssi.util;

import java.security.SecureRandom;

/**
* 随机数工具类
*
* @author xsl
* @since 2023/02/22
*/
public class RandomUtil {
    /**
     * 邮箱口令随机数
     * @return String
     */
    public static String mailRandom(){
        String basic = "123456789qwertyuiopasdfghjklzxcvbnm";
        char[] basicArray = basic.toCharArray();
        SecureRandom random = new SecureRandom();
        char[] result = new char[6];
        for (int i = 0; i < result.length; i++) {
            int index = random.nextInt(100) % (basicArray.length);
            result[i] = basicArray[index];
        }
        return new String(result);
    }
}
