Math utils
Set of simple math utilities.
Installation
$ npm install --save math-utils
Usage
// import a specific function; // or everything at once; const value = ;const mapped = mathUtils;
API
val = random(min, max, round)
(alias of getRandomValueInRange
)
Get a random value in the given [min
, max
] range.
round
is false
by default.
val = map(val, inMin, inMax, outMin, outMax)
(alias of mapValueToRange
)
Map val
from range [inMin
, inMax
] to [outMin
, outMax
] range.
val = isPOT(val)
(alias of isPowerOfTwo
)
Returns true
if val
is a power of two, false
otherwise.
License
MIT, see LICENSE.md for more details.