manticore.math library

Functions

clip<T extends num>(T vmin, T vmax, T value) → T
Clip the number between a min and max value. Same as min(vmax, max(vmin, value))
lerpInverse(double from, double to, double at) double
Get the percent (inverse lerp) from "from" to "to" where "at". If from = 0 and to = 100 and at = 25 then it would return 0.25
ms() int
r(double percent) bool
Will return true PERCENT of the time
rangeScale(double amin, double amax, double bmin, double bmax, double b) double
Scales B by an external range change so that <br/> <br/> BMIN < B < BMAX <br/> AMIN < RESULT < AMAX <br/> So Given rangeScale(0, 20, 0, 10, 5) -> 10 <br/> 0 < 5 < 10 <br/> 0 < ? < 20 <br/> would return 10