程序包 cool.scx.util
类 RandomUtils
java.lang.Object
cool.scx.util.RandomUtils
用于生成简单的随机数
- 版本:
- 0.0.1
- 作者:
- scx567888
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static intnextInt(int bound) static intnextInt(int origin, int bound) static <T> T随机从列表中取出一个元素static <T> List<T>随机从数组中取出 多个元素 (不会重复)static <T> TrandomGet(T... array) 随机从数组中取出一个元素static <T> T[]randomGet(T[] array, int size) 随机从数组中取出 多个元素 (不会重复)static intrandomNumber(int min, int max) 取一个指定区间的随机数 (包含两端)static StringrandomString(int size) 获取随机的 Code (包含字母和数字)static StringrandomString(int size, boolean withLetter) 获取随机的 Code 注意!!!static String获取UUID
-
构造器详细资料
-
RandomUtils
public RandomUtils()
-
-
方法详细资料
-
randomString
获取随机的 Code 注意!!! 此方法和 getUUID 不同 若需要获取 uuid 请使用 getUUID- 参数:
size- code 的长度withLetter- code 中是否包含字母- 返回:
- a
Stringobject
-
randomString
获取随机的 Code (包含字母和数字)- 参数:
size- code 的长度- 返回:
- a
-
randomNumber
public static int randomNumber(int min, int max) 取一个指定区间的随机数 (包含两端)- 参数:
min- 最小值max- 最大值- 返回:
- 随机数
-
randomUUID
获取UUID- 返回:
- a
Stringobject.
-
randomGet
随机从数组中取出一个元素- 类型参数:
T- T- 参数:
array- 数组- 返回:
- 随机的元素
-
randomGet
随机从列表中取出一个元素- 类型参数:
T- T- 参数:
list- 列表- 返回:
- 随机的元素
-
randomGet
public static <T> T[] randomGet(T[] array, int size) 随机从数组中取出 多个元素 (不会重复)- 类型参数:
T- t- 参数:
array- 数组size- 长度- 返回:
- a
-
randomGet
随机从数组中取出 多个元素 (不会重复)- 类型参数:
T- a- 参数:
list- 数组size- 长度- 返回:
- a
-
nextInt
public static int nextInt(int bound) -
nextInt
public static int nextInt(int origin, int bound)
-