public class Randoms extends Object
| Modifier and Type | Field and Description |
|---|---|
static char[] |
ALPHA
定义验证码字符.去除了O和I等容易混淆的字母
|
protected static int |
charMaxIndex
字符的最大索引,不包括最大值
|
protected static int |
charMinIndex
字符的最小索引,包括最小值
|
protected static int |
lowerMaxIndex
小写字母最大索引
|
protected static int |
lowerMinIndex
小写字母最小索引
|
protected static int |
numMaxIndex
数字的最大索引,不包括最大值
|
protected static Random |
RANDOM |
protected static int |
upperMaxIndex
大写字符最大索引
|
protected static int |
upperMinIndex
大写字符最小索引
|
| Constructor and Description |
|---|
Randoms() |
| Modifier and Type | Method and Description |
|---|---|
static char |
alpha()
返回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)
产生两个数之间的随机数
|
public static final char[] ALPHA
protected static final Random RANDOM
protected static final int numMaxIndex
protected static final int charMinIndex
protected static final int charMaxIndex
protected static final int upperMinIndex
protected static final int upperMaxIndex
protected static final int lowerMinIndex
protected static final int lowerMaxIndex
public static int num(int min,
int max)
min - 最小值max - 最大值public static int num(int num)
num - 最大值public static char alpha()
public static char alpha(int num)
num - 到第几位结束public static char alpha(int min,
int max)
min - 从第几位开始max - 到第几位结束Copyright © 2020. All rights reserved.