类 RandomProvider

java.lang.Object
cn.herodotus.engine.captcha.core.provider.RandomProvider

public class RandomProvider extends Object

Description: 验证码随机代码工具类

作者:
: gengwei.zheng
Date:
: 2021/12/11 15:26
  • 字段详细资料

    • 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

      public static List<String> randomWords(int wordCount)
      从字典中随机获取指定数量的汉字。
      参数:
      wordCount - 汉字数量
      返回:
      随机获取指定数量的汉字
    • randomColors

      public static Color[] randomColors(int number)
    • randomColor

      public static Color randomColor()
      获取随机常用颜色
      返回:
      随机常用颜色
    • randomColor

      public static Color randomColor(int min, int max)
    • randomCharacters

      public static String[] randomCharacters(int number, CaptchaCharacter captchaCharacter)