package com.dy.pipIrrGlobal.config; import com.dy.pipIrrGlobal.util.CaptchaUtil; import com.google.code.kaptcha.text.impl.DefaultTextCreator; import java.security.SecureRandom; import java.util.Map; import java.util.Random; /** * @author ZhuBaoMin * @date 2024-09-10 10:39 * @LastEditTime 2024-09-10 10:39 * @Description 验证码随机文本生成器:两位数的加减乘除 */ public class KaptchaMathTwoTextCreator extends DefaultTextCreator { @Override public String getText() { Random random = new SecureRandom(); // 保存计算结果 Map result = CaptchaUtil.mathTextCreator(random.nextInt(100), random.nextInt(100)); // 生成两个随机数,随机数范围:[0,100),并返回结果 return result.get("resultString"); } }