Static
clampReturns the clamped value, no lower than low and not higher than high.
Value to clamp.
Low limit.
High limit.
Static
lerpLinear interpolation between two values.
Interpolation value. 0 aligns to low, 1 aligns to high.
Low limit.
High limit.
Static
maxReturn the largest value.
This is way faster than Math.max for two values.
The 1st value.
The 2nd value.
The largest value.
Static
minReturn the smallest value.
This is way faster than Math.min for two values.
The 1st value.
The 2nd value.
The smallest value.
Static
randomReturns a random float within range [0, limit)
The upper exclusive limit of the range.
A random float.
Static
randomReturns a random "true" or "false" value.
The probability of returning true. Default is 50%.
A random int.
Static
randomReturns a random float within range [low, high)
The lower inclusive limit.
The upper exclusive limit.
A random float.
Static
randomReturns a random int within range [0, limit)
The upper exclusive limit of the range.
A random int.
Static
randomReturns a random int within range [low, high)
The lower inclusive limit.
The upper exclusive limit.
A random int.
Static
randomReturns a random index picked according to its weight.
An array of weights.
Static
rollingReturns the calculated average of adding one more value to a previous average.
Item count including the new one.
Average so far.
New item to add to average.
Static
sizeReturns a rectangle that covers the enclosing rectangle whose smaller side is minSide with the given rectangle of the given width and height, maintaining aspect ratio.
Width of a rectangle.
Height of a rectangle.
Smaller side of the enclosing rectangle.
Static
sizeReturns a rectangle that fits the given rectangle of the given width and height into an enclosing rectangle whose large side is maxSide, maintaining aspect ratio.
Width of a rectangle.
Height of a rectangle.
Larger side of the enclosing rectangle.
Math utilities.