public class RandomValues extends java.lang.Object
Constructor and Description |
---|
RandomValues() |
Modifier and Type | Method and Description |
---|---|
static <E> void |
listSwap(java.util.List<E> list,
int count)
Swaps the elements of the list to get a random order.
|
static java.math.BigDecimal |
randBigDecimal(java.math.BigDecimal min,
java.math.BigDecimal max)
Returns an equally distributed random
BigDecimal value. |
static java.math.BigInteger |
randBigInteger(java.math.BigInteger min,
java.math.BigInteger max)
Returns an equally distributed random
BigInteger value. |
static java.math.BigInteger |
randBigInteger(int numberOfBits) |
static java.lang.String |
randChars(java.lang.String chars,
int length)
Generates a string consisting of a random sequence of the specified characters.
|
static double |
randDouble(double min,
double max)
Returns an equally distributed random double value.
|
static float |
randFloat(float min,
float max)
Returns an equally distributed random float value.
|
static java.lang.String |
randHexForBits(int numberOfBits) |
static java.lang.String |
randHexForChars(int length)
Returns the string representation of a random hexadecimal value.
|
static int |
randInt(int min,
int max)
Returns an equally distributed random integer value.
|
static long |
randLong(long min,
long max)
Returns an equally distributed random long value.
|
public RandomValues()
public static int randInt(int min, int max)
min
- the lower border of the returned valuemax
- the upper border of the returned valuemin
and lower than max
public static long randLong(long min, long max)
min
- the lower border of the returned valuemax
- the upper border of the returned valuemin
and lower than max
public static float randFloat(float min, float max)
min
- the lower border of the returned valuemax
- the upper border of the returned valuemin
and lower than max
public static double randDouble(double min, double max)
min
- the lower border of the returned valuemax
- the upper border of the returned valuemin
and lower than max
public static java.math.BigDecimal randBigDecimal(java.math.BigDecimal min, java.math.BigDecimal max)
BigDecimal
value.min
- the lower border of the returned valuemax
- the upper border of the returned valuemin
and lower than max
public static java.math.BigInteger randBigInteger(java.math.BigInteger min, java.math.BigInteger max)
BigInteger
value.min
- the lower border of the returned valuemax
- the upper border of the returned valuemin
and lower than max
public static java.math.BigInteger randBigInteger(int numberOfBits)
public static java.lang.String randHexForBits(int numberOfBits)
public static java.lang.String randHexForChars(int length)
length
- public static java.lang.String randChars(java.lang.String chars, int length)
Each character contained in chars
can be selected with equal probability
for each position of the returned string. One character may also occur several
times in the same return value.
chars
- a string containing the set of characters that are allowed elements for
the returned character sequencelength
- the number of characters the returned string shall havepublic static <E> void listSwap(java.util.List<E> list, int count)
This method is only efficient for lists that allow random access.
list
- the list to be reorderedcount
- the number of swaps to perform