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

@lazy-random/distributions

v3.0.1

Published

彙整 @lazy-random 系列各種亂數分佈 (Distribution) 的聚合套件 (Aggregate Package),一次安裝即可取得常見的機率分佈與亂數工具 API

Readme

@lazy-random/distributions

彙整 (Re-export) @lazy-random 系列各種亂數分佈 (Distribution) 的聚合套件 (Aggregate Package),一次安裝即可取得常見的機率分佈與亂數工具 API。

本套件本身不實作演算法,僅轉出各子套件的函式,並額外提供 Distributions 預設匯出 (Default Export) 物件。

特色 (Features)

  • 一個套件即可取得多種機率分佈 (Probability Distribution) API
  • 同時提供具名匯出 (Named Export) 與 Distributions 預設匯出物件
  • 各函式底層皆依賴 IRNGLike 介面的 next(),可搭配任意亂數來源 (Random Number Generator)

匯出一覽 (Exports)

| 分類 (Category) | 函式 (Functions) | 來源套件 (Source Package) | | --- | --- | --- | | 連續/離散分佈 | dfBates dfBernoulli dfBinomial dfExponential dfGeometric dfIrwinHall dfLogNormal dfNormal dfPareto | @lazy-random/df-algorithm | | 泊松分佈 | dfPoisson | @lazy-random/df-poisson | | 均勻分佈 | dfUniformFloat dfUniformInt dfUniformBoolean dfUniformByte dfUniformBytes | @lazy-random/df-uniform | | 陣列操作 | dfArrayIndex dfArrayIndexOne dfArrayShuffle dfArrayUnique dfArrayFill | @lazy-random/df-array | | 權重抽樣 | dfItemByWeight dfItemByWeightUnique | @lazy-random/df-item-by-weight | | 字元識別碼 | dfCharID | @lazy-random/df-char-id | | 固定總和 | dfRandSumFloat dfRandSumInt | @lazy-random/df-sum | | UUID | dfUuidV4 | @lazy-random/df-uuid |

安裝 (Installation)

yarn add @lazy-random/distributions
yarn-tool add @lazy-random/distributions
yt add @lazy-random/distributions

或使用 pnpm:

pnpm add @lazy-random/distributions

使用方式 (Usage)

具名匯出 (Named Export)

import { dfPoisson, dfUniformInt, dfUuidV4 } from '@lazy-random/distributions';

const poisson = dfPoisson(random, 4);
const int = dfUniformInt(random, 1, 6);
const uuid = dfUuidV4(random);

console.log(poisson());
console.log(int());
console.log(uuid());

預設匯出 (Default Export)

import Distributions from '@lazy-random/distributions';

const { dfNormal, dfArrayShuffle } = Distributions;

console.log(typeof dfNormal); // "function"
console.log(typeof dfArrayShuffle); // "function"

API 文件 (API Documentation)

各函式的詳細參數與回傳值請參閱對應子套件的 README:

設定 (Configuration)

本套件無設定檔,所有函式的行為皆由各自參數控制。

開發 (Development)

pnpm run build

變更日誌 (Changelog)

請見 CHANGELOG.md。

相關資源 (Related Resources)