类 RandomProvider
java.lang.Object
cn.herodotus.engine.captcha.core.provider.RandomProvider
Description: 验证码随机代码工具类
- 作者:
- : gengwei.zheng
- Date:
- : 2021/12/11 15:26
-
字段概要
字段修饰符和类型字段说明static final int字符的最大枚举值,不包括最大值static final int字符的最小枚举值,包括最小值static final int小写字母最大枚举值static final int小写字母最小枚举值static final int数字的最大枚举值,不包括最大值static final int数字的最大枚举值,不包括最大值static final int大写字符最大枚举值static final int大写字符最小枚举值 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static String[]randomCharacters(int number, CaptchaCharacter captchaCharacter) static Color获取随机常用颜色static ColorrandomColor(int min, int max) static Color[]randomColors(int number) static intrandomInt(int bound) 获得指定范围内的随机数 [0,limit)static intrandomInt(int startInclusive, int endExclusive) 获得指定范围内的随机数randomWords(int wordCount) 从字典中随机获取指定数量的汉字。
-
字段详细资料
-
NUM_MIN_INDEX
public static final int NUM_MIN_INDEX数字的最大枚举值,不包括最大值- 另请参阅:
-
NUM_MAX_INDEX
public static final int NUM_MAX_INDEX数字的最大枚举值,不包括最大值- 另请参阅:
-
CHAR_MIN_INDEX
public static final int CHAR_MIN_INDEX字符的最小枚举值,包括最小值- 另请参阅:
-
CHAR_MAX_INDEX
public static final int CHAR_MAX_INDEX字符的最大枚举值,不包括最大值 -
UPPER_MIN_INDEX
public static final int UPPER_MIN_INDEX大写字符最小枚举值- 另请参阅:
-
UPPER_MAX_INDEX
public static final int UPPER_MAX_INDEX大写字符最大枚举值- 另请参阅:
-
LOWER_MIN_INDEX
public static final int LOWER_MIN_INDEX小写字母最小枚举值- 另请参阅:
-
LOWER_MAX_INDEX
public static final int LOWER_MAX_INDEX小写字母最大枚举值
-
-
构造器详细资料
-
RandomProvider
public RandomProvider()
-
-
方法详细资料
-
randomInt
public static int randomInt(int startInclusive, int endExclusive) 获得指定范围内的随机数Tips:用自己的方法重新包装,方便今后修改。
Hutool RandomUtil 支持负数;common-lang3 RandomUtils不支持负数
- 参数:
startInclusive- 最小数(包含)endExclusive- 最大数(不包含)- 返回:
- 随机数
-
randomInt
public static int randomInt(int bound) 获得指定范围内的随机数 [0,limit)Tips:用自己的方法重新包装,方便今后修改
- 参数:
bound- 限制随机数的范围,不包括这个数- 返回:
- 随机数
-
randomWords
从字典中随机获取指定数量的汉字。- 参数:
wordCount- 汉字数量- 返回:
- 随机获取指定数量的汉字
-
randomColors
-
randomColor
获取随机常用颜色- 返回:
- 随机常用颜色
-
randomColor
-
randomCharacters
-