| | |
| | | import cn.hutool.core.math.Calculator; |
| | | import cn.hutool.core.util.CharUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 无符号计算生成器 |
| | |
| | | int max = RandomUtil.randomInt(min, limit); |
| | | String number1 = Integer.toString(max); |
| | | String number2 = Integer.toString(min); |
| | | number1 = StrUtil.padAfter(number1, this.numberLength, CharUtil.SPACE); |
| | | number2 = StrUtil.padAfter(number2, this.numberLength, CharUtil.SPACE); |
| | | number1 = StringUtils.rightPad(number1, this.numberLength, CharUtil.SPACE); |
| | | number2 = StringUtils.rightPad(number2, this.numberLength, CharUtil.SPACE); |
| | | |
| | | return number1 + RandomUtil.randomChar(operators) + number2 + '='; |
| | | } |
| | |
| | | * @return 最大值 |
| | | */ |
| | | private int getLimit() { |
| | | return Integer.parseInt("1" + StrUtil.repeat('0', this.numberLength)); |
| | | return Integer.parseInt("1" + StringUtils.repeat('0', this.numberLength)); |
| | | } |
| | | } |