public final class RandomUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static char[] |
CHAR_LIST
默认随机字符集合
|
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
nextBoolean()
获取随机布尔值
|
static Color |
nextColor()
随机色
|
static Color |
nextColor(int num)
随机色
|
static Color |
nextColor(int num,
int factor)
随机色
|
static double |
nextDouble()
获取随机双精度浮点数
|
static float |
nextFloat()
获取随机单精度浮点数
|
static int |
nextInt()
获取一个随机int数
|
static int |
nextInt(int n)
获取一个不大于n的随机int数
|
static long |
nextLong()
获取一个随机long
|
static long |
nextLong(long n)
获取一个随机long
|
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 long nextLong()
public static long nextLong(long n)
n - long值最大值public static boolean nextBoolean()
public static float nextFloat()
public static double nextDouble()
public static Color nextColor(int num, int factor)
num - 随机色范围factor - 随机色偏移量public static Color nextColor(int num)
num - 随机色范围public static Color nextColor()
Copyright © 2017. All rights reserved.