|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.xiaoleilu.hutool.RandomUtil
public class RandomUtil
随机工具类
| 构造方法摘要 | |
|---|---|
RandomUtil()
|
|
| 方法摘要 | ||
|---|---|---|
static
|
randomEle(List<T> list)
随机获得列表中的元素 |
|
static
|
randomEle(List<T> list,
int limit)
随机获得列表中的元素 |
|
static
|
randomEles(List<T> list,
int count)
随机获得列表中的一定量元素 |
|
static int |
randomInt()
获得随机数 |
|
static int |
randomInt(int limit)
获得指定范围内的随机数 [0,limit) |
|
static int |
randomInt(int min,
int max)
获得指定范围内的随机数 |
|
static String |
randomNumbers(int length)
获得一个只包含数字的字符串 |
|
static String |
randomString(int length)
获得一个随机的字符串(只包含数字和字符) |
|
static String |
randomString(String baseString,
int length)
获得一个随机的字符串 |
|
static String |
randomUUID()
|
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public RandomUtil()
| 方法详细信息 |
|---|
public static int randomInt(int min,
int max)
min - 最小数max - 最大数
public static int randomInt()
public static int randomInt(int limit)
limit - 限制随机数的范围,不包括这个数
public static <T> T randomEle(List<T> list)
T - 元素类型list - 列表
public static <T> T randomEle(List<T> list,
int limit)
T - 元素类型list - 列表limit - 限制列表的前N项
public static <T> List<T> randomEles(List<T> list,
int count)
T - 元素类型list - 列表count - 随机取出的个数
public static String randomString(int length)
length - 字符串的长度
public static String randomNumbers(int length)
length - 字符串的长度
public static String randomString(String baseString,
int length)
baseString - 随机字符选取的样本length - 字符串的长度
public static String randomUUID()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||