Class LumpDistribution

java.lang.Object
com.github.tommyettinger.random.distribution.Distribution
com.github.tommyettinger.random.distribution.LumpDistribution
All Implemented Interfaces:
Externalizable, Serializable

public class LumpDistribution extends Distribution
A two-parameter distribution with range between 0 inclusive and 1 exclusive. Currently, the values for mean, median, mode, and variance are unknown; if someone wants to contribute a way to calculate them, that would be appreciated.
The idea for this was first implemented in SquidLib as TweakRNG. This has changed and no longer has 4 spikes, but still acts the same with how it can be tweaked.
See Also:
  • Constructor Details

    • LumpDistribution

      public LumpDistribution()
      Uses an AceRandom, alpha = 0.0, beta = 0.25 .
    • LumpDistribution

      public LumpDistribution(double alpha, double beta)
      Uses an AceRandom and the given alpha and beta.
    • LumpDistribution

      public LumpDistribution(EnhancedRandom generator, double alpha, double beta)
      Uses the given EnhancedRandom directly. Uses the given alpha and beta.
  • Method Details

    • getTag

      public String getTag()
      Description copied from class: Distribution
      Gets the tag used to identify this type of Distribution, as a String. This tag should be unique. Unlike the tags for EnhancedRandom types, the names here can vary in length.
      Specified by:
      getTag in class Distribution
      Returns:
      a unique String identifier for this type of Distribution; must be non-null, can be any non-zero length
    • copy

      public LumpDistribution copy()
      Description copied from class: Distribution
      Returns an exact copy of this Distribution, with the same parameters and a copy of the generator.
      Specified by:
      copy in class Distribution
      Returns:
      an exact copy of this Distribution
    • getAlpha

      public double getAlpha()
      Affects whether returned values will be lower (for lower alpha) or higher (for higher alpha).
      Returns:
      the A parameter
    • getBeta

      public double getBeta()
      Affects extremity vs. centrality; higher values favor extremes.
      Returns:
      the B parameter
    • getParameterA

      public double getParameterA()
      Description copied from class: Distribution
      Gets the value of parameter "A" as a double. This corresponds to parameter "A" in Distribution.setParameters(double, double, double); it is usually called by some other name in the generator, and may not be stored as a double internally.
      This defaults to always returning Double.NaN, but any parameters a distribution actually uses should be overridden to return the actual parameter, which is almost certainly not going to be NaN. If a getParameter method returns NaN, you can generally safely assume that the parameter is not used by this distribution.
      Overrides:
      getParameterA in class Distribution
      Returns:
      the value of parameter "A" as a double.
    • getParameterB

      public double getParameterB()
      Description copied from class: Distribution
      Gets the value of parameter "B" as a double. This corresponds to parameter "B" in Distribution.setParameters(double, double, double); it is usually called by some other name in the generator, and may not be stored as a double internally.
      This defaults to always returning Double.NaN, but any parameters a distribution actually uses should be overridden to return the actual parameter, which is almost certainly not going to be NaN. If a getParameter method returns NaN, you can generally safely assume that the parameter is not used by this distribution.
      Overrides:
      getParameterB in class Distribution
      Returns:
      the value of parameter "B" as a double.
    • getMaximum

      public double getMaximum()
      Description copied from class: Distribution
      Gets the maximum possible value of distributed random numbers.
      Specified by:
      getMaximum in class Distribution
      Returns:
      the maximum possible value of distributed random numbers
    • getMean

      public double getMean()
      Description copied from class: Distribution
      Gets the mean of distributed random numbers.
      Specified by:
      getMean in class Distribution
      Returns:
      the mean of distributed random numbers
    • getMedian

      public double getMedian()
      Description copied from class: Distribution
      Gets the median of distributed random numbers.
      Specified by:
      getMedian in class Distribution
      Returns:
      the median of distributed random numbers
    • getMinimum

      public double getMinimum()
      Description copied from class: Distribution
      Gets the minimum possible value of distributed random numbers.
      Specified by:
      getMinimum in class Distribution
      Returns:
      the minimum possible value of distributed random numbers
    • getMode

      public double[] getMode()
      Description copied from class: Distribution
      Gets the mode(s) of distributed random numbers.
      Specified by:
      getMode in class Distribution
      Returns:
      the mode(s) of distributed random numbers
    • getVariance

      public double getVariance()
      Description copied from class: Distribution
      Gets the variance of distributed random numbers.
      Specified by:
      getVariance in class Distribution
      Returns:
      the variance of distributed random numbers
    • setParameters

      public boolean setParameters(double a, double b, double c)
      Sets all parameters and returns true if they are valid, otherwise leaves parameters unchanged and returns false.
      Specified by:
      setParameters in class Distribution
      Parameters:
      a - alpha; cannot be NaN, and is usually near 0
      b - beta; cannot be NaN, and is usually near 0
      c - ignored
      Returns:
      true if the parameters given are valid and will be used
    • nextDouble

      public double nextDouble()
      Description copied from class: Distribution
      Generates a double using this distribution.
      Specified by:
      nextDouble in class Distribution
      Returns:
      a distributed double
    • sample

      public static double sample(EnhancedRandom generator, double alpha, double beta)