Package de.alpharogroup.random.number
Class RandomPrimitivesExtensions
- java.lang.Object
-
- de.alpharogroup.random.number.RandomPrimitivesExtensions
-
public final class RandomPrimitivesExtensions extends java.lang.ObjectUtility class for producing random privimitive types
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetRandomIntBetween(int minVolume, int maxVolume)Returns a random int between the range from minVolume and maxVolume with theMath.absmethod.static booleanrandomBoolean()Returns a random boolean.static byterandomByte()The Method randomByte() selects a random byte.static byte[]randomByteArray(int length)The Method randomByteArray(int) generates a random byte array.static charrandomChar()Returns a random char.static charrandomChar(java.lang.String string)The Method randomChar(String) selects a random char from the given String.static doublerandomDouble()The Method randomDouble() gets a random doublestatic doublerandomDouble(double range)The Method randomDouble(double) gets an double to the spezified range.static doublerandomDouble(double range, 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.9static doublerandomDoubleBetween(double start, double end)Gets the random double between the range from start and end.static floatrandomFloat()Generates a random float between the range 0.0-9.9.static floatrandomFloat(float range)The Method randomFloat(float) gets an float to the spezified range.static floatrandomFloat(float range, 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.9static floatrandomFloat(int afterComma, int beforeComma)The Method getRandomFloat(int,int) gets an random float.static floatrandomFloatBetween(float start, float end)Gets the random float between the range from start and end.static intrandomInt()The Method randomInt() gets an int between the range 0-9.static intrandomInt(int range)The Method randomInt(int) gets an int to the spezified range.static intrandomInt(int range, de.alpharogroup.random.enums.RandomAlgorithm algorithm)The Method randomInt(int) gets an int to the spezified range.static intrandomIntBetween(int start, int end)Returns a random int between the range from start and end.static intrandomIntBetween(int start, int end, boolean includeMin, boolean includeMax)Returns a random int between the range from start and end.static longrandomLong()Gets a random longstatic longrandomLong(long range)The Method randomLong(long) gets an long to the spezified range.static longrandomLong(long range, 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-9static longrandomLongBetween(long start, long end)Returns a random long between the range from start and end.static shortrandomShort()Returns a random short
-
-
-
Method Detail
-
getRandomIntBetween
public static int getRandomIntBetween(int minVolume, int maxVolume)Returns a random int between the range from minVolume and maxVolume with theMath.absmethod.- Parameters:
minVolume- the min volumemaxVolume- the max volume- Returns:
- A random int between the range from minVolume and maxVolume
-
randomBoolean
public static boolean randomBoolean()
Returns a random boolean.- Returns:
- The random boolean.
-
randomByte
public static byte randomByte()
The Method randomByte() selects a random byte.- Returns:
- The random byte.
-
randomByteArray
public static byte[] randomByteArray(int length)
The Method randomByteArray(int) generates a random byte array.- Parameters:
length- the length.- Returns:
- the byte[]
-
randomChar
public static char randomChar()
Returns a random char.- Returns:
- The generated random char.
-
randomChar
public static char randomChar(java.lang.String string)
The Method randomChar(String) selects a random char from the given String.- Parameters:
string- The String from who to select the char.- Returns:
- The selected char.
-
randomDouble
public static double randomDouble()
The Method randomDouble() gets a random double- Returns:
- the random double
-
randomDouble
public static double randomDouble(double range)
The Method randomDouble(double) gets an double to the spezified range. For example: if you put range to 10.0 the random int is between 0.0-9.9.- Parameters:
range- the range- Returns:
- the double
-
randomDouble
public static double randomDouble(double range, 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- Parameters:
range- the rangealgorithm- the random algorithm- Returns:
- an random double not greater then the range
-
randomDoubleBetween
public static double randomDoubleBetween(double start, double end)Gets the random double between the range from start and end.- Parameters:
start- the startend- the end- Returns:
- the random double between
-
randomFloat
public static float randomFloat()
Generates a random float between the range 0.0-9.9.- Returns:
- the generated random float between the range 0.0-9.9.
-
randomFloat
public static float randomFloat(float range)
The Method randomFloat(float) gets an float to the spezified range. For example: if you put range to 10.0 the random int is between 0.0-9.9.- Parameters:
range- the range- Returns:
- the float
-
randomFloat
public static float randomFloat(float range, 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- Parameters:
range- the rangealgorithm- the random algorithm- Returns:
- an random float not greater then the range
-
randomFloat
public static float randomFloat(int afterComma, int beforeComma)The Method getRandomFloat(int,int) gets an random float.- Parameters:
afterComma- How many decimal places after the comma.beforeComma- How many decimal places before the comma.- Returns:
- The produced float.
-
randomFloatBetween
public static float randomFloatBetween(float start, float end)Gets the random float between the range from start and end.- Parameters:
start- the startend- the end- Returns:
- the random float between
-
randomInt
public static int randomInt()
The Method randomInt() gets an int between the range 0-9.- Returns:
- an int between the range 0-9.
-
randomInt
public static int randomInt(int range)
The Method randomInt(int) gets an int to the spezified range. For example: if you put range to 10 the random int is between 0-9.- Parameters:
range- The Range.- Returns:
- an int not greater then the range.
-
randomInt
public static int randomInt(int range, de.alpharogroup.random.enums.RandomAlgorithm algorithm)The Method randomInt(int) gets an int to the spezified range. For example: if you put range to 10 the random int is between 0-9.- Parameters:
range- The rangealgorithm- the random algorithm- Returns:
- an int not greater then the range
-
randomIntBetween
public static int randomIntBetween(int start, int end)Returns a random int between the range from start and end.- Parameters:
start- The int from where the range starts.end- The int from where the range ends.- Returns:
- A random int between the range from start and end.
-
randomIntBetween
public static int randomIntBetween(int start, int end, boolean includeMin, boolean includeMax)Returns a random int between the range from start and end.- Parameters:
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 included- Returns:
- A random int between the range from start and end.
-
randomLong
public static long randomLong()
Gets a random long- Returns:
- a random long
-
randomLong
public static long randomLong(long range)
The Method randomLong(long) gets an long to the spezified range. For example: if you put range to 10 the random int is between 0-9.- Parameters:
range- the range- Returns:
- an long not greater then the range.
-
randomLong
public static long randomLong(long range, 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- Parameters:
range- the rangealgorithm- the random algorithm- Returns:
- an random long not greater then the range
-
randomLongBetween
public static long randomLongBetween(long start, long end)Returns a random long between the range from start and end.- Parameters:
start- The long from where the range starts.end- The long from where the range ends.- Returns:
- A random long between the range from start and end.
-
randomShort
public static short randomShort()
Returns a random short- Returns:
- The generated random short
-
-