npm install math-utils
Set of simple math utilities.
``sh`
$ npm install --save math-utils
`js
// import a specific function
import { random } from 'math-utils';
// or everything at once
import * as mathUtils from 'math-utils';
const value = random(0, 50, true);
const mapped = mathUtils.map(24, 0, 100, 0, 1);
`
#### 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.
MIT, see LICENSE.md for more details.