npm.io
1.2.0 • Published 10 months ago

bias-random

Licence
MIT
Version
1.2.0
Deps
0
Size
12 kB
Vulns
0
Weekly
0

bias-random

npm npm npm Buy Me A Coffee

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

Installation

npm i bias-random

# or
yarn add bias-random

# or
pnpm i bias-random

Usage

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
  • On npm: package page -> CHANGELOG.md
  • In the repository: CHANGELOG.md

Buy me a coffee if this package helped you!

Keywords