public final class RandomGenerator extends Object
| Modifier and Type | Method and Description |
|---|---|
static <E> E |
rand_array(E[] array)
Picks a random value from an array.
|
static byte[] |
rand_bytes(int size)
Generates a random byte array.
|
static <E> E |
rand_collection(Collection<E> collection)
Picks a random value from a collection.
|
static Date |
rand_date_days(int min,
int max)
Obtains a random date based on the actual date.
|
static Date |
rand_date(int min,
int max)
Obtains a random date based on the actual date.
|
static <E extends Enum<E>> |
rand_enum_value(Class<E> enumType)
Returns a random value from a supplied enumeration (which cannot be an
empty enumeration).
|
static int |
rand_int(int max)
Obtains a random number between [0, max[.
|
static int |
rand_int(int min,
int max)
Obtains a random number between [min, max[.
|
public static int rand_int(int max)
max - the maximum valuepublic static int rand_int(int min,
int max)
min - the minimum numbermax - the maximum numberpublic static byte[] rand_bytes(int size)
size - the array sizepublic static Date rand_date(int min, int max)
min - the distance to the minimum of the interval (in seconds)max - the distance to the maximum of the interval (in seconds)public static Date rand_date_days(int min, int max)
min - the distance to the minimum of the interval (in days)max - the distance to the maximum of the interval (in days)public static <E extends Enum<E>> E rand_enum_value(Class<E> enumType)
E - the type of the enumerationenumType - the class of enumerationpublic static <E> E rand_array(E[] array)
E - the type of valuearray - the array to pick values from (cannot be empty or
null)public static <E> E rand_collection(Collection<E> collection)
E - the type of valuecollection - the collection to pick values from (cannot be empty or
null)Copyright © 2015. All rights reserved.