Package toxi.util.datatypes
Class FloatRange
java.lang.Object
toxi.util.datatypes.FloatRange
- Direct Known Subclasses:
BiasedFloatRange
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
adjustCurrentBy
(float val) copy()
static FloatRange
fromSamples
(float... samples) static FloatRange
fromSamples
(List<Float> samples) final float
getAt
(float perc) Returns the value at the normalized position(0.0 = min ...
float
float
float
getRange()
boolean
isValueInRange
(float val) float
seed
(long seed) float
setCurrent
(float val) Float[]
toArray
(float step) toString()
-
Field Details
-
min
public float min -
max
public float max -
currValue
public float currValue
-
-
Constructor Details
-
FloatRange
public FloatRange() -
FloatRange
public FloatRange(float min, float max)
-
-
Method Details
-
fromSamples
-
fromSamples
-
adjustCurrentBy
public float adjustCurrentBy(float val) -
copy
-
getAt
public final float getAt(float perc) Returns the value at the normalized position(0.0 = min ... 1.0 = max-EPS)
within the range. Since the max value is exclusive, the value returned for position 1.0 is the range max value minusMathUtils.EPS
. 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 float getCurrent() -
getMedian
public float getMedian() -
getRange
public float getRange() -
isValueInRange
public boolean isValueInRange(float val) -
pickRandom
public float pickRandom() -
seed
-
setCurrent
public float setCurrent(float val) -
setRandom
-
toArray
-
toString
-