Class Random

  • All Implemented Interfaces:
    java.io.Serializable

    public class Random
    extends java.util.Random
    This class extends Java's basic random features with extra primitives that are likely to be useful to introduce random parameters in requests and testing scenarios...
    Author:
    Bruno Dillenseger
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Random()  
      Random​(long seed)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getInputStream()
      Input stream access to the random generator.
      long nextGaussian​(int min, int max, int mean, int deviation)
      Gaussian law distribution
      long nextNegativeExponential​(int min, int mean)
      Negative exponential law distribution
      long nextPoisson​(double parameter, int factor)
      Poisson law distribution
      java.lang.StringBuilder nextStringBuilder​(int length)  
      long nextUniform​(int min, int max)
      Uniform distribution
      • Methods inherited from class java.util.Random

        doubles, doubles, doubles, doubles, ints, ints, ints, ints, longs, longs, longs, longs, next, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed
      • Methods inherited from class java.lang.Object

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

      • Random

        public Random()
        See Also:
        Random()
      • Random

        public Random​(long seed)
        Parameters:
        seed -
        See Also:
        Random(long)
    • Method Detail

      • nextUniform

        public long nextUniform​(int min,
                                int max)
        Uniform distribution
        Parameters:
        min - minimum value (inclusive)
        max - maximum value (exclusive)
        Returns:
        a random value according to a uniform distribution
      • nextPoisson

        public long nextPoisson​(double parameter,
                                int factor)
        Poisson law distribution
        Parameters:
        factor - the result is multiplied by this factor
        parameter - both mean and deviation value for the Poisson law
        Returns:
        a random value according to a Poisson law distribution
      • nextGaussian

        public long nextGaussian​(int min,
                                 int max,
                                 int mean,
                                 int deviation)
        Gaussian law distribution
        Parameters:
        min - minimum value
        max - maximum value
        mean - values mean
        deviation - values deviation
        Returns:
        a random value according to a gaussian law distribution
      • nextNegativeExponential

        public long nextNegativeExponential​(int min,
                                            int mean)
        Negative exponential law distribution
        Parameters:
        min - minimum value
        mean - values mean
        Returns:
        a random value according to a negative exponential law distribution
      • nextStringBuilder

        public java.lang.StringBuilder nextStringBuilder​(int length)
        Parameters:
        length - the number of characters of the generated string
        Returns:
        a random character string of the specified length
      • getInputStream

        public java.io.InputStream getInputStream()
        Input stream access to the random generator.
        Returns:
        an input stream generating uniformly distributed random values between 0 and 255 included. This input stream does not support the mark operation.