# math-utils

> Set of simple math utilities.

Latest version **1.0.2** (published 2016-03-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install math-utils
pnpm add math-utils
yarn add math-utils
bun add math-utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-03-07 |
| First published | 2016-01-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | vaalentin |
| Maintainers | vaalentin |
| Keywords | math, utils |

## Links

- npm: https://www.npmjs.com/package/math-utils
- Repository: https://github.com/vaalentin/math-utils
- Homepage: https://github.com/vaalentin/math-utils#readme
- Issues: https://github.com/vaalentin/math-utils/issues
- npm.io page: https://npm.io/package/math-utils

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2016-03-07
- 1.0.1 — 2016-02-04
- 1.0.0 — 2016-01-16

## README

# Math utils

[![Build Status](https://travis-ci.org/vaalentin/math-utils.svg?branch=master)](https://travis-ci.org/vaalentin/math-utils)

Set of simple math utilities.

## Installation

```sh
$ npm install --save math-utils
```

## Usage

```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);
```

## 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](https://en.wikipedia.org/wiki/Power_of_two), `false` otherwise.

## License

MIT, see [LICENSE.md](https://github.com/vaalentin/math-utils/blob/master/LICENSE.md) for more details.

---
_Source: https://npm.io/package/math-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
