public final class RandomUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static char[] |
CHAR_LIST
默认随机字符集合
|
| 限定符和类型 | 方法和说明 |
|---|---|
static BigDecimal |
nextBigDecimal()
获取随机高精度浮点数
|
static BigInteger |
nextBigInteger()
获取随机高精度整数
|
static boolean |
nextBoolean()
获取随机布尔值
|
static double |
nextDouble()
获取随机双精度浮点数
|
static double |
nextDouble(double bound)
返回一个介于0.0和bound之间的双精度浮点数
|
static double |
nextDouble(double origin,
double bound)
返回一个介于origin和bound之间的双精度浮点数
|
static float |
nextFloat()
获取随机单精度浮点数
|
static int |
nextInt()
获取一个随机整型
|
static int |
nextInt(int n)
获取一个不大于n的随机整型
|
static int |
nextInt(int origin,
int bound)
返回一个介于origin和bound之间的整型
|
static long |
nextLong()
获取一个随机长整型
|
static long |
nextLong(long n)
获取一个随机长整型
|
static long |
nextLong(long origin,
long bound)
返回一个介于origin和bound之间的长整型
|
static String |
nextString(int length)
随机字符串,取值范围(a-zA-Z0-9)
|
static String |
nextString(int length,
char[] chars)
自定义取值范围的随机字符串
|
public static String nextString(int length)
length - 字符串长度public static String nextString(int length, char[] chars)
length - 字符串长度chars - 取值范围public static int nextInt()
public static int nextInt(int n)
n - 随机数最大值public static int nextInt(int origin,
int bound)
origin - originbound - boundpublic static long nextLong()
public static long nextLong(long n)
n - 长整型最大值public static long nextLong(long origin,
long bound)
origin - originbound - boundpublic static boolean nextBoolean()
public static float nextFloat()
public static double nextDouble()
public static double nextDouble(double bound)
bound - boundpublic static double nextDouble(double origin,
double bound)
origin - originbound - boundpublic static BigDecimal nextBigDecimal()
public static BigInteger nextBigInteger()
Copyright © 2021 guerlab. All rights reserved.