public final class RandomExtensions extends Object
| Constructor and Description |
|---|
RandomExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static Byte[] |
getRandomByteArray(int length)
Deprecated.
use instead the method
newRandomByteObjects in the
RandomObjectFactory class. Note: will be remove in the next minor release |
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<?>> |
getRandomEnumFromClass(Class<T> clazz)
Gets the random enum.
|
static <T extends Enum<?>> |
getRandomEnumFromClassname(String classname)
Gets the random enum.
|
static <T extends Enum<?>> |
getRandomEnumFromEnumValues(T[] values)
Gets the random enum.
|
static <T extends Enum<?>> |
getRandomEnumFromObject(T obj)
Gets the random enum.
|
static Float |
getRandomFloat(int afterComma,
int beforeComma)
Deprecated.
use instead the method
newRandomByteObjects in the
RandomObjectFactory class. Note: will be remove in the next minor release |
static String |
getRandomHexString(int numberOfCharacters)
Generates a random hexadecimal
String |
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 byte[] |
getRandomSalt(int length,
Charset charset)
Gets the random salt.
|
static String |
getRandomString()
Generates a random string with a length between 3 and 25
|
static String |
getRandomString(int length)
Generates a random string.
|
static String |
getRandomString(int start,
int end)
Generates a random string with a length between the given start and end
|
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 int |
newRandomPixel()
Generates a random int for use with pixel.
|
static int |
newRandomPixel(int red,
int green,
int blue,
int alpha)
Generates a random int for use with pixel.
|
static byte[] |
newSalt()
Factory method for create a new random salt.
|
static BigInteger |
randomSerialNumber()
Returns a random serial number that can be used for a serial number.
|
static String |
randomToken()
Returns a random token for use in web services.
|
static UUID |
randomUUID()
Factory method for create a new random
UUID |
public static int newRandomPixel()
public static int newRandomPixel(int red,
int green,
int blue,
int alpha)
red - The red value.green - The green value.blue - The blue value.alpha - The alpha value.@Deprecated public static Byte[] getRandomByteArray(int length)
newRandomByteObjects in the
RandomObjectFactory class. 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 getRandomEnumFromClass(Class<T> clazz)
T - the generic typeclazz - the clazzpublic static <T extends Enum<?>> T getRandomEnumFromClassname(String classname)
T - the generic typeclassname - the classnamepublic static <T extends Enum<?>> T getRandomEnumFromObject(T obj)
T - the generic typeobj - the objpublic static <T extends Enum<?>> T getRandomEnumFromEnumValues(T[] values)
T - the generic typevalues - the values@Deprecated public static Float getRandomFloat(int afterComma, int beforeComma)
newRandomByteObjects in the
RandomObjectFactory class. 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 getRandomString(int length)
length - the specified length.public static String getRandomHexString(int numberOfCharacters)
StringnumberOfCharacters - the number of charactersStringpublic 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()
public static String getRandomString(int start, int end)
start - the startend - the endpublic static String getRandomString(String[] array)
array - The array with the String to be selected.public static UUID randomUUID()
UUIDUUIDpublic static String randomToken()
public static BigInteger randomSerialNumber()
BigInteger object.public static byte[] newSalt()
public static byte[] getRandomSalt(int length,
Charset charset)
length - the lengthcharset - the charsetCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.