public final class RandomUtils
extends java.lang.Object
desc : Random Utils
author : xuexiang
time : 2018/4/28 上午12:41
shuffle(Object[]) Shuffling algorithm, Randomly permutes the specified array using a default source of
randomnessshuffle(Object[], int) Shuffling algorithm, Randomly permutes the specified arrayshuffle(int[]) Shuffling algorithm, Randomly permutes the specified int array using a default source of
randomnessshuffle(int[], int) Shuffling algorithm, Randomly permutes the specified int arraygetRandom(int) get random int between 0 and maxgetRandom(int, int) get random int between min and maxgetRandomCapitalLetters(int) get a fixed-length random string, its a mixture of uppercase lettersgetRandomLetters(int) get a fixed-length random string, its a mixture of uppercase and lowercase letters
getRandomLowerCaseLetters(int) get a fixed-length random string, its a mixture of lowercase lettersgetRandomNumbers(int) get a fixed-length random string, its a mixture of numbersgetRandomNumbersAndLetters(int) get a fixed-length random string, its a mixture of uppercase, lowercase
letters and numbersgetRandom(String, int) get a fixed-length random string, its a mixture of chars in sourcegetRandom(char[], int) get a fixed-length random string, its a mixture of chars in sourceChar| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CAPITAL_LETTERS |
static java.lang.String |
LETTERS |
static java.lang.String |
LOWER_CASE_LETTERS |
static java.lang.String |
NUMBERS |
static java.lang.String |
NUMBERS_AND_LETTERS |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getRandom(char[] sourceChar,
int length)
在一个字符数组源中获取一个定长的随机字符串
|
static int |
getRandom(int max)
get random int between 0 and max
|
static int |
getRandom(int min,
int max)
get random int between min and max
|
static java.lang.String |
getRandom(java.lang.String source,
int length)
在一个字符数组源中获取一个定长的随机字符串
|
static java.lang.String |
getRandomCapitalLetters(int length)
在大写英文字母中获取一个定长的随机字符串
|
static int |
getRandomColor()
获取随机颜色
|
static java.lang.String |
getRandomLetters(int length)
在英文字母中获取一个定长的随机字符串
|
static java.lang.String |
getRandomLowerCaseLetters(int length)
在小写英文字母中获取一个定长的随机字符串
|
static java.lang.String |
getRandomNumbers(int length)
在数字中获取一个定长的随机字符串
|
static java.lang.String |
getRandomNumbersAndLetters(int length)
在数字和英文字母中获取一个定长的随机字符串
|
static int[] |
shuffle(int[] intArray)
随机打乱数组中的内容
|
static int[] |
shuffle(int[] intArray,
int shuffleCount)
随机打乱数组中的内容
|
static boolean |
shuffle(java.lang.Object[] objArray)
随机打乱数组中的内容
|
static boolean |
shuffle(java.lang.Object[] objArray,
int shuffleCount)
随机打乱数组中的内容
|
public static final java.lang.String NUMBERS_AND_LETTERS
public static final java.lang.String NUMBERS
public static final java.lang.String LETTERS
public static final java.lang.String CAPITAL_LETTERS
public static final java.lang.String LOWER_CASE_LETTERS
public static java.lang.String getRandomNumbersAndLetters(int length)
length - 长度getRandom(String source, int length)public static java.lang.String getRandomNumbers(int length)
length - 长度getRandom(String source, int length)public static java.lang.String getRandomLetters(int length)
length - 长度getRandom(String source, int length)public static java.lang.String getRandomCapitalLetters(int length)
length - 长度getRandom(String source, int length)public static java.lang.String getRandomLowerCaseLetters(int length)
length - 长度getRandom(String source, int length)public static java.lang.String getRandom(java.lang.String source,
int length)
source - 源字符串length - 长度getRandom(char[] sourceChar, int length)public static java.lang.String getRandom(char[] sourceChar,
int length)
sourceChar - 字符数组源length - 长度public static int getRandom(int max)
max - 最大随机数public static int getRandom(int min,
int max)
min - 最小随机数max - 最大随机数public static int getRandomColor()
public static boolean shuffle(java.lang.Object[] objArray)
objArray - public static boolean shuffle(java.lang.Object[] objArray,
int shuffleCount)
objArray - shuffleCount - public static int[] shuffle(int[] intArray)
intArray - public static int[] shuffle(int[] intArray,
int shuffleCount)
intArray - shuffleCount -