类 Randoms

java.lang.Object
com.wf.captcha.base.Randoms
直接已知子类:
Captcha

public class Randoms extends Object
随机数工具类 Created by 王帆 on 2018-07-27 上午 10:08.
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final char[]
    定义验证码字符.去除了0、O、I、L等容易混淆的字母
    protected static final int
    字符的最大索引,不包括最大值
    protected static final int
    字符的最小索引,包括最小值
    protected static final int
    小写字母最大索引
    protected static final int
    小写字母最小索引
    protected static final int
    数字的最大索引,不包括最大值
    protected static final SecureRandom
     
    protected static final int
    大写字符最大索引
    protected static final int
    大写字符最小索引
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    static char
    返回ALPHA中的随机字符
    static char
    alpha(int num)
    返回ALPHA中第0位到第num位的随机字符
    static char
    alpha(int min, int max)
    返回ALPHA中第min位到第max位的随机字符
    static int
    num(int num)
    产生0-num的随机数,不包括num
    static int
    num(int min, int max)
    产生两个数之间的随机数

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • ALPHA

      public static final char[] ALPHA
      定义验证码字符.去除了0、O、I、L等容易混淆的字母
    • RANDOM

      protected static final SecureRandom RANDOM
    • numMaxIndex

      protected static final int numMaxIndex
      数字的最大索引,不包括最大值
      另请参阅:
    • charMinIndex

      protected static final int charMinIndex
      字符的最小索引,包括最小值
      另请参阅:
    • upperMinIndex

      protected static final int upperMinIndex
      大写字符最小索引
      另请参阅:
    • upperMaxIndex

      protected static final int upperMaxIndex
      大写字符最大索引
      另请参阅:
    • lowerMinIndex

      protected static final int lowerMinIndex
      小写字母最小索引
      另请参阅:
    • charMaxIndex

      protected static final int charMaxIndex
      字符的最大索引,不包括最大值
    • lowerMaxIndex

      protected static final int lowerMaxIndex
      小写字母最大索引
  • 构造器详细资料

    • Randoms

      public Randoms()
  • 方法详细资料

    • num

      public static int num(int min, int max)
      产生两个数之间的随机数
      参数:
      min - 最小值
      max - 最大值
      返回:
      随机数
    • num

      public static int num(int num)
      产生0-num的随机数,不包括num
      参数:
      num - 最大值
      返回:
      随机数
    • alpha

      public static char alpha()
      返回ALPHA中的随机字符
      返回:
      随机字符
    • alpha

      public static char alpha(int num)
      返回ALPHA中第0位到第num位的随机字符
      参数:
      num - 到第几位结束
      返回:
      随机字符
    • alpha

      public static char alpha(int min, int max)
      返回ALPHA中第min位到第max位的随机字符
      参数:
      min - 从第几位开始
      max - 到第几位结束
      返回:
      随机字符