Class IDistribution.SimpleDistribution

java.lang.Object
squidpony.squidmath.IDistribution.SimpleDistribution
All Implemented Interfaces:
IDistribution
Direct Known Subclasses:
BathtubDistribution, CurvedBoundedDistribution, SpikeDistribution.SimpleSpikeDistribution
Enclosing interface:
IDistribution

public abstract static class IDistribution.SimpleDistribution
extends Object
implements IDistribution
  • Constructor Details

  • Method Details

    • fractionalDistribution

      Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by getting the fractional component of a result from otherDistribution.
      Parameters:
      otherDistribution - any other IDistribution
      Returns:
      a new anonymous implementation of SimpleDistribution that gets the fractional part of otherDistribution.
    • fractionalOffsetDistribution

      public static IDistribution.SimpleDistribution fractionalOffsetDistribution​(IDistribution otherDistribution, double offset)
      Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by getting the fractional component of offset plus a result from otherDistribution. Using the offset allows distributions like GaussianDistribution to become centered halfway on 0.5, making the result of this distribution have a Gaussian-like peak on 0.5 instead of of peaking at the bounds when offset is 0.0.
      Parameters:
      otherDistribution - any other IDistribution
      Returns:
      a new anonymous implementation of SimpleDistribution that gets the fractional part of otherDistribution.
    • clampedDistribution

      Makes a new SimpleDistribution implementation given any IDistribution (typically one with large or infinite bounds) by simply clamping results that are below 0 to 0 and at least 1 to 0.9999999999999999 (the largest double less than 1.0 than can be represented). This will behave very oddly for distributions that are centered on 0.0.
      Parameters:
      otherDistribution - any other IDistribution
      Returns:
      a new anonymous implementation of SimpleDistribution that clamps otherDistribution in range.
    • getLowerBound

      public double getLowerBound()
      Gets the lower inclusive bound, which is 0.0.
      Specified by:
      getLowerBound in interface IDistribution
      Returns:
      the lower inclusive bound of the distribution, 0.0
    • getUpperBound

      public double getUpperBound()
      Gets the upper exclusive bound of the distribution, which is 1.0.
      Specified by:
      getUpperBound in interface IDistribution
      Returns:
      the upper exclusive bound of the distribution, 1.0