|
@@ -5,7 +5,7 @@ import com.google.code.kaptcha.text.impl.DefaultTextCreator; |
|
@@ -5,7 +5,7 @@ import com.google.code.kaptcha.text.impl.DefaultTextCreator; |
|
5
|
|
5
|
|
|
6
|
/**
|
6
|
/**
|
|
7
|
* 验证码文本生成器
|
7
|
* 验证码文本生成器
|
|
8
|
- *
|
8
|
+ *
|
|
9
|
* @author ruoyi
|
9
|
* @author ruoyi
|
|
10
|
*/
|
10
|
*/
|
|
11
|
public class KaptchaTextCreator extends DefaultTextCreator
|
11
|
public class KaptchaTextCreator extends DefaultTextCreator
|
|
@@ -20,7 +20,7 @@ public class KaptchaTextCreator extends DefaultTextCreator |
|
@@ -20,7 +20,7 @@ public class KaptchaTextCreator extends DefaultTextCreator |
|
20
|
int x = random.nextInt(10);
|
20
|
int x = random.nextInt(10);
|
|
21
|
int y = random.nextInt(10);
|
21
|
int y = random.nextInt(10);
|
|
22
|
StringBuilder suChinese = new StringBuilder();
|
22
|
StringBuilder suChinese = new StringBuilder();
|
|
23
|
- int randomoperands = (int) Math.round(Math.random() * 2);
|
23
|
+ int randomoperands = random.nextInt(3);
|
|
24
|
if (randomoperands == 0)
|
24
|
if (randomoperands == 0)
|
|
25
|
{
|
25
|
{
|
|
26
|
result = x * y;
|
26
|
result = x * y;
|
|
@@ -30,7 +30,7 @@ public class KaptchaTextCreator extends DefaultTextCreator |
|
@@ -30,7 +30,7 @@ public class KaptchaTextCreator extends DefaultTextCreator |
|
30
|
}
|
30
|
}
|
|
31
|
else if (randomoperands == 1)
|
31
|
else if (randomoperands == 1)
|
|
32
|
{
|
32
|
{
|
|
33
|
- if (!(x == 0) && y % x == 0)
|
33
|
+ if ((x != 0) && y % x == 0)
|
|
34
|
{
|
34
|
{
|
|
35
|
result = y / x;
|
35
|
result = y / x;
|
|
36
|
suChinese.append(CNUMBERS[y]);
|
36
|
suChinese.append(CNUMBERS[y]);
|