Package toxi.util.datatypes
Class IntegerRange
java.lang.Object
toxi.util.datatypes.IntegerRange
- Direct Known Subclasses:
BiasedIntegerRange
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintadjustCurrentBy(int val) copy()static IntegerRangefromSamples(int... samples) static IntegerRangefromSamples(List<Integer> samples) final intgetAt(float perc) Returns the value at the normalized position(0.0 = min ...final intfinal intfinal intgetRange()final booleanisValueInRange(int val) intseed(long seed) intsetCurrent(int val) Integer[]toArray()toString()
-
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
-
fromSamples
-
adjustCurrentBy
public int adjustCurrentBy(int val) -
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
-
setCurrent
public int setCurrent(int val) -
setRandom
-
toArray
-
toString
-