Class IntegerRange

java.lang.Object
toxi.util.datatypes.IntegerRange
Direct Known Subclasses:
BiasedIntegerRange

public class IntegerRange extends Object
  • Field Details

    • min

      public int min
    • max

      public int max
    • currValue

      public int currValue
  • Constructor Details

    • IntegerRange

      public IntegerRange()
    • IntegerRange

      public IntegerRange(int min, int max)
  • Method Details

    • fromSamples

      public static IntegerRange fromSamples(int... samples)
    • fromSamples

      public static IntegerRange fromSamples(List<Integer> samples)
    • adjustCurrentBy

      public int adjustCurrentBy(int val)
    • copy

      public IntegerRange copy()
    • getAt

      public final int getAt(float perc)
      Returns the value at the normalized position (0.0 = min ... 1.0 = max-1) within the range. Since the max value is exclusive, the value returned for position 1.0 is the range max value minus 1. Also note the given position is not being clipped to the 0.0-1.0 interval, so when passing in values outside that interval will produce out-of-range values too.
      Parameters:
      perc -
      Returns:
      value within the range
    • getCurrent

      public final int getCurrent()
    • getMedian

      public final int getMedian()
    • getRange

      public final int getRange()
    • isValueInRange

      public final boolean isValueInRange(int val)
    • pickRandom

      public int pickRandom()
    • seed

      public IntegerRange seed(long seed)
    • setCurrent

      public int setCurrent(int val)
    • setRandom

      public IntegerRange setRandom(Random rnd)
    • toArray

      public Integer[] toArray()
    • toString

      public String toString()
      Overrides:
      toString in class Object