Class Sampler


  • public class Sampler
    extends Object
    Used to generate random values for different distributions

    Sampler class diagram

    • Constructor Detail

      • Sampler

        public Sampler()
    • Method Detail

      • discreteUniform

        public float discreteUniform​(Float deb,
                                     Float end)
        Sample discrete values within a given interval
        Parameters:
        deb - beginning of interval
        end - end of interval
        Returns:
      • invertTransform

        public int invertTransform​(int lambda)
        ---(1-ln(x))²*lambda
        Parameters:
        lambda - the parameter to increase the result
        Returns:
        an invertTransform value
      • weibull

        public double weibull​(double x,
                              int coef,
                              double mean)
        return the weibull result of the x input with the specific parameters the coef must be > 1 to have a correct shape
      • invertTransformWeibull

        public float invertTransformWeibull​(double k,
                                            float mean)
        invert repartition function of Weibull = lambda*(-log(1-x))^(1/k) repartition function of Weibull = 1-exp(-(x/lambda)^k)
        Parameters:
        k - the shape of the function and to increase of the result
        lambda - the coefficient to increase the result
        Returns:
        the value
      • gaussian

        public double gaussian​(double x,
                               float mean,
                               double deviation)
        return a gaussian value dependending of x, the mean, and the deviation
      • gaussSampler

        public float gaussSampler​(float average,
                                  double deviation)
        Parameters:
        deviation - : the scale
        average - : the lowerbound value
        Returns:
        a random value following the gaussian law