类 RandomUtils
- java.lang.Object
-
- com.alibaba.nacos.common.utils.RandomUtils
-
public class RandomUtils extends java.lang.ObjectRandom utils.- 作者:
- zzq
-
-
字段概要
字段 修饰符和类型 字段 说明 private static java.util.RandomRANDOMRandom Object for random method.
-
构造器概要
构造器 构造器 说明 RandomUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 private static voidcheckParameters(long startInclusive, long endExclusive)Check input parameters.static intnextInt(int startInclusive, int endExclusive)Returns a random integer within the specified range.static longnextLong(long startInclusive, long endExclusive)Returns a random long within the specified range.
-
-
-
方法详细资料
-
nextLong
public static long nextLong(long startInclusive, long endExclusive)Returns a random long within the specified range.- 参数:
startInclusive- the smallest value that can be returned, must be non-negativeendExclusive- the upper bound (not included)- 返回:
- the random long
- 抛出:
java.lang.IllegalArgumentException- if startInclusive or endExclusive illegal
-
nextInt
public static int nextInt(int startInclusive, int endExclusive)Returns a random integer within the specified range.- 参数:
startInclusive- lower limit, must be non-negativeendExclusive- the upper bound (not included)- 返回:
- the random integer
- 抛出:
java.lang.IllegalArgumentException- if startInclusive or endExclusive illegal
-
checkParameters
private static void checkParameters(long startInclusive, long endExclusive)Check input parameters.- 参数:
startInclusive- lower limit, must be non-negativeendExclusive- the upper bound (not included)
-
-