npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@3-/biasedrng

v0.1.4

Published

Biased random number generator. 可偏向的随机数生成器。

Readme

English | 中文

@3-/biasedrng

Biased random number generator.

This module provides a function to generate random numbers with a bias towards smaller values.

Installation

npm install @3-/biasedrng

Usage

import biasedrng from '@3-/biasedrng';

// Generate a random integer between 0 and 99
// The distribution is biased towards 0.
const randomNumber = biasedrng(100);

// You can also specify a bias factor.
// A higher bias value means a stronger bias towards 0.
const highlyBiasedNumber = biasedrng(100, 10);

console.log(`A random number with default bias: ${randomNumber}`);
console.log(`A random number with high bias: ${highlyBiasedNumber}`);

biasedrng(n, bias = 7)

  • n (Integer): The upper bound (exclusive) for the random number generation. Must be a positive integer.
  • bias (Number): The bias strength.
    • bias > 1: Smaller numbers are more likely. The larger the value, the stronger the bias.
    • bias = 1: The distribution is close to uniform.
    • 0 < bias < 1: Larger numbers are more likely (inverse bias).
 0 |██████████████████████████████████████████████████ 6438 (64.38%)
 1 |█████ 682 (6.82%)
 2 |███ 439 (4.39%)
 3 |██ 320 (3.20%)
 4 |██ 233 (2.33%)
 5 |██ 206 (2.06%)
 6 |██ 195 (1.95%)
 7 |█ 179 (1.79%)
 8 |█ 165 (1.65%)
 9 |█ 162 (1.62%)
10 |█ 118 (1.18%)
11 |█ 129 (1.29%)
12 |█ 116 (1.16%)
13 |█ 120 (1.20%)
14 |█ 98 (0.98%)
15 |█ 81 (0.81%)
16 |█ 88 (0.88%)
17 |█ 93 (0.93%)
18 |█ 75 (0.75%)
19 | 63 (0.63%)

@3-/biasedrng

可偏向的随机数生成器。

本模块提供一个函数,可以生成一个倾向于较小值的随机数。

安装

npm install @3-/biasedrng

使用方法

import biasedrng from '@3-/biasedrng';

// 生成一个在 [0, 100) 区间内的随机整数
// 分布会偏向于 0
const randomNumber = biasedrng(100);

// 你也可以指定一个偏向参数
// 偏向参数越大,结果就越偏向于 0
const highlyBiasedNumber = biasedrng(100, 10);

console.log(`一个默认偏向的随机数: ${randomNumber}`);
console.log(`一个高偏向的随机数: ${highlyBiasedNumber}`);

biasedrng(n, bias = 7)

  • n (整数): 生成随机数的上限(不包含该数)。必须是一个大于 0 的正整数。
  • bias (数字): 偏向强度参数。
    • bias > 1: 数值越小,被选中的概率越高。值越大,偏向越强。
    • bias = 1: 接近于标准的均匀分布。
    • 0 < bias < 1: 结果会反向偏向于 n(即数值大的概率更高)。
 0 |██████████████████████████████████████████████████ 6438 (64.38%)
 1 |█████ 682 (6.82%)
 2 |███ 439 (4.39%)
 3 |██ 320 (3.20%)
 4 |██ 233 (2.33%)
 5 |██ 206 (2.06%)
 6 |██ 195 (1.95%)
 7 |█ 179 (1.79%)
 8 |█ 165 (1.65%)
 9 |█ 162 (1.62%)
10 |█ 118 (1.18%)
11 |█ 129 (1.29%)
12 |█ 116 (1.16%)
13 |█ 120 (1.20%)
14 |█ 98 (0.98%)
15 |█ 81 (0.81%)
16 |█ 88 (0.88%)
17 |█ 93 (0.93%)
18 |█ 75 (0.75%)
19 | 63 (0.63%)

About

This project is an open-source component of i18n.site ⋅ Internationalization Solution.

关于

本项目为 i18n.site ⋅ 国际化解决方案 的开源组件。