package com.qmth.paper.library.common.util;

import org.apache.commons.lang3.StringUtils;

/**
 * 生成随机数
 */
public class CodeUtil {

    public static String getVerificationCode(String normalCode) {
        StringBuilder sb = new StringBuilder();
        sb.append((int) ((Math.random() * 9 + 1) * 1000));
        String verifyCode = sb.toString();

        if (StringUtils.isNotBlank(normalCode) && verifyCode.equals(normalCode)) {
            getVerificationCode(normalCode);
        }

        return verifyCode;
    }
}
