类 RandomKit
java.lang.Object
com.iohao.game.common.kit.RandomKit
- 作者:
- 渔民小镇
- 日期:
- 2022-07-14
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明int
random
(int end) 获得指定范围内的随机数 (0 ~ end)int
random
(int start, int end) 获得指定范围内的随机数long
random
(long end) 获得指定范围内的随机数 (0 ~ end)long
random
(long start, long end) 获得指定范围内的随机数boolean
随机一个 bool 值<T> T
<T> T
randomEle
(T[] array) int
randomInt
(int limit) 获得指定范围内的随机数 [0,limit)int
randomInt
(int min, int max) 获得指定范围内的随机数long
randomLong
(long limit) 获得指定范围内的随机数 [0,limit)long
randomLong
(long min, long max) 获得指定范围内的随机数
-
构造器详细资料
-
RandomKit
public RandomKit()
-
-
方法详细资料
-
randomInt
public int randomInt(int limit) 获得指定范围内的随机数 [0,limit)- 参数:
limit
- 限制随机数的范围,不包括这个数- 返回:
- 随机数
-
randomInt
public int randomInt(int min, int max) 获得指定范围内的随机数- 参数:
min
- 最小数(包含)max
- 最大数(不包含)- 返回:
- 随机数
-
randomLong
public long randomLong(long limit) 获得指定范围内的随机数 [0,limit)- 参数:
limit
- 限制随机数的范围,不包括这个数- 返回:
- 随机数
- 从以下版本开始:
- 21.23
-
randomLong
public long randomLong(long min, long max) 获得指定范围内的随机数- 参数:
min
- 最小数(包含)max
- 最大数(不包含)- 返回:
- 随机数
- 从以下版本开始:
- 21.23
-
random
public int random(int start, int end) 获得指定范围内的随机数- 参数:
start
- 开始值(包含)end
- 结束值(包含)- 返回:
- 随机数
-
random
public int random(int end) 获得指定范围内的随机数 (0 ~ end)- 参数:
end
- 结束值(包含)- 返回:
- 随机数
-
random
public long random(long start, long end) 获得指定范围内的随机数- 参数:
start
- 开始值(包含)end
- 结束值(包含)- 返回:
- 随机数
- 从以下版本开始:
- 21.23
-
random
public long random(long end) 获得指定范围内的随机数 (0 ~ end)- 参数:
end
- 结束值(包含)- 返回:
- 随机数
- 从以下版本开始:
- 21.23
-
randomBoolean
public boolean randomBoolean()随机一个 bool 值- 返回:
- bool 值
-
randomEle
-
randomEle
public <T> T randomEle(T[] array)
-