# bias-random

> Generates biased random numbers with a customizable bias level, direction, and range

Latest version **1.2.0** (published 2026-01-15) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-01-15 |
| First published | 2024-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 0 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Reid Moffat |
| Maintainers | reidmoffat |
| Keywords | random, bias, biased, random-bias, weighted-random, probability, skewed-random, biased-numbers, random-distribution, random-skew, weighted-numbers, probability-distribution, random-bias-generator, custom-distribution, random-number-generator, rng, biased-probability, skewed-distribution |

## Links

- npm: https://www.npmjs.com/package/bias-random
- Repository: https://github.com/reid-moffat/bias-random
- Homepage: https://www.npmjs.com/package/bias-random?activeTab=readme
- Issues: https://github.com/reid-moffat/bias-random/issues
- Funding: https://buymeacoffee.com/reidmoffat
- npm.io page: https://npm.io/package/bias-random

## 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.2.0 (latest) — 2026-01-15
- 1.1.0 — 2025-10-22
- 1.0.3 — 2025-10-21
- 1.0.2 — 2024-10-18
- 1.0.1 — 2024-09-24
- 1.0.0 — 2024-09-24

## README

# bias-random

[![npm](https://img.shields.io/npm/v/bias-random)](https://www.npmjs.com/package/bias-random)
[![npm](https://img.shields.io/npm/dt/bias-random)](https://www.npmjs.com/package/bias-random)
[![npm](https://img.shields.io/npm/l/bias-random)](https://www.npmjs.com/package/bias-random)
[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-support-yellow?logo=buy-me-a-coffee)](https://buymeacoffee.com/reidmoffat)

Generates biased random numbers with a customizable bias level, direction, and range

## 📦 Installation
```bash
npm i bias-random

# or
yarn add bias-random

# or
pnpm i bias-random
```

## 🚀 Usage
```ts
import biasedRandom from "bias-random";

// Default settings:
// -Bias towards lower numbers
// -Bias level of 2
// -Range 0 to 1
// Average resulting value will be 1/3
const defaultResult = biasedRandom();

// Cutomize the parmeters (all parameters are optional, defaulting to the values above)
const customResult = biasedRandom({ upperBias: true, biasLevel: 4, min: 10, max: 1000 });
```

## 📃 Changelog

To view the release notes for each version, view the changelog:

* On GitHub: [Link](https://github.com/reid-moffat/bias-random/blob/main/CHANGELOG.md)
* On npm: [package page](https://www.npmjs.com/package/bias-random?activeTab=code) -> CHANGELOG.md
* In the repository: CHANGELOG.md

---

☕ [Buy me a coffee](https://buymeacoffee.com/reidmoffat) if this package helped you!

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