# @ahmerhh/math-functions

> Set of simple math utilities.

Latest version **1.0.6** (published 2023-08-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ahmerhh/math-functions
pnpm add @ahmerhh/math-functions
yarn add @ahmerhh/math-functions
bun add @ahmerhh/math-functions
```

## 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.6 |
| Published | 2023-08-13 |
| First published | 2023-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | ahmerhh |
| Maintainers | ahmerhh |
| Keywords | math, functions, utils |

## Links

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

## 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.6 (latest) — 2023-08-13

## README

# Math utils

Set of simple math utilities.

## Installation

```sh
$ npm install --save math-functions
```

## Usage

```js
// import a specific function
import { random } from 'math-functions';

// or everything at once
import * as mathUtils from 'math-functions';

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/ahmerhh/math-functions/blob/master/LICENSE.md) for more details.

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