public final class RandomPrimitivesExtensions
extends java.lang.Object
| Constructor and Description |
|---|
RandomPrimitivesExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static int |
getRandomIntBetween(int minVolume,
int maxVolume)
Returns a random int between the range from minVolume and maxVolume with the
Math.abs method. |
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(java.lang.String string)
The Method randomChar(String) selects a random char from the given String.
|
static double |
randomDouble()
The Method randomDouble() gets a random double
|
static double |
randomDouble(double range)
The Method randomDouble(double) gets an double to the spezified range.
|
static double |
randomDouble(double range,
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
Gets an random double to the given range with the given random algorithm
For example: if you put range to 10 the random float is between 0.0-9.9 |
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,
java.lang.String pattern)
Gets the random double between the range from start and end in the given pattern.
|
static float |
randomFloat()
Generates a random float between the range 0.0-9.9.
|
static float |
randomFloat(float range)
The Method randomFloat(float) gets an float to the spezified range.
|
static float |
randomFloat(float range,
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
Gets an random float to the given range with the given random algorithm
For example: if you put range to 10 the random float is between 0.0-9.9 |
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,
java.lang.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 |
randomInt(int range,
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
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.
|
static int |
randomIntBetween(int start,
int end,
boolean includeMin,
boolean includeMax)
Returns a random int between the range from start and end.
|
static long |
randomLong()
Gets a random long
|
static long |
randomLong(long range)
The Method randomLong(long) gets an long to the spezified range.
|
static long |
randomLong(long range,
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
Gets an random long to the given range with the given random algorithm
For example: if you put range to 10 the random int is between 0-9 |
static long |
randomLongBetween(long start,
long end)
Returns a random long between the range from start and end.
|
static short |
randomShort()
Returns a random short
|
public static boolean randomBoolean()
public static byte randomByte()
public static byte[] randomByteArray(int length)
length - the length.public static char randomChar()
public static short randomShort()
public static char randomChar(java.lang.String string)
string - The String from who to select the char.public static long randomLong()
public static long randomLong(long range)
range - the rangepublic static long randomLong(long range,
@NonNull
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
range - the rangealgorithm - the random algorithmpublic static long randomLongBetween(long start,
long end)
start - The long from where the range starts.end - The long from where the range ends.public static float randomFloat()
public static double randomDouble(double range)
range - the rangepublic static double randomDouble(double range,
@NonNull
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
range - the rangealgorithm - the random algorithmpublic static double randomDouble()
public static double randomDoubleBetween(double start,
double end)
start - the startend - the endpublic static double randomDoubleBetween(double start,
double end,
java.lang.String pattern)
throws java.text.ParseException
DecimalFormat.start - the startend - the endpattern - the patternjava.text.ParseException - is thrown if the beginning of the specified string cannot be parsedpublic static float randomFloat(float range)
range - the rangepublic static float randomFloat(float range,
@NonNull
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
range - the rangealgorithm - the random algorithmpublic 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,
java.lang.String pattern)
throws java.text.ParseException
DecimalFormat.start - the startend - the endpattern - the patternjava.text.ParseException - is thrown if the beginning of the specified string cannot be parsedpublic static int randomInt()
public static int randomInt(int range)
range - The Range.public static int randomInt(int range,
@NonNull
@NonNull de.alpharogroup.random.enums.RandomAlgorithm algorithm)
range - The rangealgorithm - the random algorithmpublic static int randomIntBetween(int start,
int end)
start - The int from where the range starts.end - The int from where the range ends.public static int randomIntBetween(int start,
int end,
boolean includeMin,
boolean includeMax)
start - The int from where the range starts.end - The int from where the range ends.includeMin - if true than min value is includedincludeMax - if true than max value is includedpublic static int getRandomIntBetween(int minVolume,
int maxVolume)
Math.abs method.minVolume - the min volumemaxVolume - the max volume