public class RandomUtils extends Object
| Constructor and Description |
|---|
RandomUtils() |
| Modifier and Type | Method and Description |
|---|---|
static BigDecimal |
getRandomBigDecimal(int afterComma,
int beforeComma)
The Method getRandomBigDecimal(int,int) gets an random BigDecimal.
|
static Byte |
getRandomByte()
The Method getRandomByte() selects a random Byte object.
|
static Byte[] |
getRandomByteArray(int length)
The Method getRandomByteArray(int) generates a random Byte array.
|
static <T> T |
getRandomEntry(List<T> list)
Returns a random entry from the given List.
|
static <K,V> Object |
getRandomEntry(Map<K,V> map)
Returns a random entry from the given map.
|
static <T extends Enum<?>> |
getRandomEnum(Class<T> clazz)
Gets the random enum.
|
static <T extends Enum<?>> |
getRandomEnum(String classname)
Gets the random enum.
|
static <T extends Enum<?>> |
getRandomEnum(T obj)
Gets the random enum.
|
static <T extends Enum<?>> |
getRandomEnum(T[] values)
Gets the random enum.
|
static Float |
getRandomFloat(int afterComma,
int beforeComma)
The Method getRandomFloat(int,int) gets an random float.
|
static <T> int |
getRandomIndex(Collection<T> list)
Returns a random index from the given List.
|
static <K,V> Object |
getRandomKey(Map<K,V> map)
Returns a random key from the given map.
|
static String |
getRandomNumericString()
Generates a random numeric string.
|
static String |
getRandomNumericString(int length)
The Method getRandomNumericString(int) produces a random Number to the specified length.
|
static String |
getRandomString(int length)
Generates a random string.
|
static String |
getRandomString(String[] array)
The Method randomString(String []) a random String from the Array For example: The
Stringarray test as argument.
|
static String |
getRandomString(String chars,
int length)
The Method randomString(String, int) makes an random String from the given String and to the
spezified length.
|
static boolean |
randomBoolean()
Returns a random boolean.
|
static byte |
randomByte()
The Method randomByte() selects a random byte.
|
static byte[] |
randomByteArray(int length)
The Method randomByteArray(int) generates a random byte array.
|
static char |
randomChar()
Returns a random char.
|
static char |
randomChar(String string)
The Method randomChar(String) selects a random char from the given String.
|
static double |
randomDouble(double range)
The Method randomDouble(double) gets an double to the spezified range.
|
static double |
randomDoubleBetween(double start,
double end)
Gets the random double between the range from start and end.
|
static double |
randomDoubleBetween(double start,
double end,
String pattern)
Gets the random double between the range from start and end in the given pattern.
|
static float |
randomFloat(float range)
The Method randomFloat(float) gets an float to the spezified range.
|
static float |
randomFloat(int afterComma,
int beforeComma)
The Method getRandomFloat(int,int) gets an random float.
|
static float |
randomFloatBetween(float start,
float end)
Gets the random float between the range from start and end.
|
static float |
randomFloatBetween(float start,
float end,
String pattern)
Gets the random float between the range from start and end in the given pattern.
|
static int |
randomInt()
The Method randomInt() gets an int between the range 0-9.
|
static int |
randomInt(int range)
The Method randomInt(int) gets an int to the spezified range.
|
static int |
randomIntBetween(int start,
int end)
Returns a random int between the range from start and end.
|
public static BigDecimal getRandomBigDecimal(int afterComma, int beforeComma)
afterComma - How many decimal places after the comma.beforeComma - How many decimal places before the comma.public static Byte getRandomByte()
public static Byte[] getRandomByteArray(int length)
length - the length.public static <T> T getRandomEntry(List<T> list)
T - the generic typelist - The List.public static <K,V> Object getRandomEntry(Map<K,V> map)
K - the key typeV - the value typemap - The map.public static <T extends Enum<?>> T getRandomEnum(Class<T> clazz)
T - the generic typeclazz - the clazzpublic static <T extends Enum<?>> T getRandomEnum(String classname)
T - the generic typeclassname - the classnamepublic static <T extends Enum<?>> T getRandomEnum(T obj)
T - the generic typeobj - the objpublic static <T extends Enum<?>> T getRandomEnum(T[] values)
T - the generic typevalues - the valuespublic static Float getRandomFloat(int afterComma, int beforeComma)
afterComma - How many decimal places after the comma.beforeComma - How many decimal places before the comma.public static <T> int getRandomIndex(Collection<T> list)
T - the generic typelist - The List.public static <K,V> Object getRandomKey(Map<K,V> map)
K - the key typeV - the value typemap - The map.public static String getRandomNumericString()
public static String getRandomNumericString(int length)
length - The length from the random number.public static String getRandomString(int length)
length - the specified length.public static String getRandomString(String chars, int length)
chars - The String to get the random chars.length - The length from the random String.public static String getRandomString(String[] array)
array - The array with the String to be selected.public static boolean randomBoolean()
public static byte randomByte()
public static byte[] randomByteArray(int length)
length - the length.public static char randomChar()
public static char randomChar(String string)
string - The String from who to select the char.public static double randomDouble(double range)
range - the rangepublic static double randomDoubleBetween(double start,
double end)
start - the startend - the endpublic static double randomDoubleBetween(double start,
double end,
String pattern)
DecimalFormat.start - the startend - the endpattern - the patternpublic static float randomFloat(float range)
range - the rangepublic static float randomFloat(int afterComma,
int beforeComma)
afterComma - How many decimal places after the comma.beforeComma - How many decimal places before the comma.public static float randomFloatBetween(float start,
float end)
start - the startend - the endpublic static float randomFloatBetween(float start,
float end,
String pattern)
DecimalFormat.start - the startend - the endpattern - the patternpublic static int randomInt()
public static int randomInt(int range)
range - The Range.public static int randomIntBetween(int start,
int end)
start - The int from where the range starts.end - The int from where the range ends.Copyright © 2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.