public class RandomValues extends Object
Constructor and Description |
---|
RandomValues() |
Modifier and Type | Method and Description |
---|---|
static <E> void |
listSwap(List<E> list,
int count)
Swaps the elements of the list to get a random order.
|
static BigDecimal |
randBigDecimal(BigDecimal min,
BigDecimal max)
Returns an equally distributed random
BigDecimal value. |
static BigInteger |
randBigInteger(BigInteger min,
BigInteger max)
Returns an equally distributed random
BigInteger value. |
static BigInteger |
randBigInteger(int numberOfBits) |
static String |
randChars(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 String |
randHexForBits(int numberOfBits) |
static 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 BigDecimal randBigDecimal(BigDecimal min, 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 BigInteger randBigInteger(BigInteger min, 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 BigInteger randBigInteger(int numberOfBits)
public static String randHexForBits(int numberOfBits)
public static String randHexForChars(int length)
length
- public static String randChars(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 have