Package toxi.util.datatypes
Class IntegerRange
java.lang.Object
toxi.util.datatypes.IntegerRange
- Direct Known Subclasses:
BiasedIntegerRange
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
adjustCurrentBy
(int val) copy()
static IntegerRange
fromSamples
(int... samples) static IntegerRange
fromSamples
(List<Integer> samples) final int
getAt
(float perc) Returns the value at the normalized position(0.0 = min ...
final int
final int
final int
getRange()
final boolean
isValueInRange
(int val) int
seed
(long seed) int
setCurrent
(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
-