Class RandomPrimitivesExtensions


  • public final class RandomPrimitivesExtensions
    extends java.lang.Object
    Utility class for producing random privimitive types
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method 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, 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 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, 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 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, 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, 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getRandomIntBetween

        public static int getRandomIntBetween​(int minVolume,
                                              int maxVolume)
        Returns a random int between the range from minVolume and maxVolume with the Math.abs method.
        Parameters:
        minVolume - the min volume
        maxVolume - 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 range
        algorithm - 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 start
        end - 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 range
        algorithm - 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 start
        end - 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 range
        algorithm - 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 included
        includeMax - 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 range
        algorithm - 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