# alea-random

> `lodash.random` but using Alea

Latest version **6.0.3** (published 2026-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install alea-random
pnpm add alea-random
yarn add alea-random
bun add alea-random
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 6.0.3 |
| Published | 2026-08-28 |
| First published | 2014-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 22 \|\| >=24 |
| Dependencies | 4 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Kenan Yildirim <kenan@kenany.me> (https://kenany.me/) |
| Maintainers | kenan |
| Keywords | alea, math, random |

## Links

- npm: https://www.npmjs.com/package/alea-random
- Repository: https://github.com/kenany/alea-random
- npm.io page: https://npm.io/package/alea-random

## Dependencies (4)

- [alea](https://npm.io/package/alea.md) ^1.0.1
- [uuid](https://npm.io/package/uuid.md) ^14.0.2
- [lodash.tonumber](https://npm.io/package/lodash.tonumber.md) ^4.18.0
- [lodash._isiterateecall](https://npm.io/package/lodash._isiterateecall.md) ^3.0.9

## 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

- 6.0.3 (latest) — 2026-08-28
- 6.0.2 — 2026-07-06
- 6.0.1 — 2026-05-11
- 6.0.0 — 2026-05-11
- 5.0.6 — 2026-05-11
- 5.0.5 — 2026-05-11
- 5.0.4 — 2025-03-30
- 5.0.3 — 2024-12-04
- 5.0.2 — 2024-06-26
- 5.0.1 — 2023-10-06
- 5.0.0 — 2023-09-04
- 4.0.1 — 2022-11-17
- 4.0.0 — 2022-11-17
- 3.0.0 — 2022-01-03
- 2.1.6 — 2021-10-17
- … 13 more at https://npm.io/package/alea-random/versions

## README

# alea-random

`lodash.random` but using [Alea](https://github.com/coverslide/node-alea)
instead of `Math.random`.

## Example

``` javascript
var aleaRandom = require('alea-random');

aleaRandom(0, 5);
// => an integer between 0 and 5

aleaRandom(5);
// => also an integer between 0 and 5

aleaRandom(5, true);
// => a floating-point number between 0 and 5

aleaRandom(1.2, 5.2);
// => a floating-point number between 1.2 and 5.2
```

## Installation

``` bash
$ npm install alea-random
```

## API

``` javascript
var aleaRandom = require('alea-random');
```

### `aleaRandom([min=0], [max=1], [floating=false])`

Produces a random number between `min` and `max` (inclusive). If only one
argument is provided a number between `0` and the given number will be returned.
If `floating` is truey or either `min` or `max` are floats a floating-point
number will be returned instead of an integer.

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