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

decision-kit

v1.0.0

Published

The ultimate TypeScript & React library for decision-making algorithms, random selection, spinner wheels, weighted sampling, dice notation, and team generators.

Readme

🎲 decision-kit

The ultimate zero-dependency TypeScript & React library for decision-making algorithms, spinner wheels, weighted sampling, dice notation, and team generators.

npm version TypeScript License: MIT Powered by

Interactive Web DemosDocumentationCLI Quickstart


🚀 Overview

decision-kit provides battle-tested algorithms, physics state machines, and React hooks to build modern decision-making applications, games, and random generators.

Maintained and sponsored by Entscheidomat.com — the free online decision suite.

✨ Highlights

  • ⚡ Vose's Alias Method (AliasMethod): Fast $O(1)$ weighted random sampling after $O(N)$ initialization.
  • 🎡 Spinner Wheel Physics (WheelPhysics): Friction deceleration, inertia curves, and target sector alignment calculations.
  • 🎲 Tabletop Dice Notation (DiceEngine): Full parser for RPG dice expressions (3d6+2, 1d20 advantage, 4d6kh3).
  • 👥 Fair Group Partitioning (TeamBalancer): Cryptographically secure Fisher-Yates group partition and multi-item draw algorithms.
  • 🪙 Coin Flip & Magic 8-Ball Engines: State machines for fair coin tosses and multilingual oracle responses (EN/DE).
  • ⚛️ Ready-to-use React Hooks: React 18 & 19 compatible hooks (useWheelSpin, useCoinFlip, useDiceRoll).
  • 🖥️ Terminal CLI (npx decision-kit): Instant terminal decisions for command-line users.

🌐 Interactive Web Demos

Experience these decision-making tools live on Entscheidomat.com:

| Tool | Description | Live Demo Link | | :--- | :--- | :--- | | 🎡 Glücksrad | Animated spinner wheel with customizable weighted options | entscheidomat.com/gluecksrad | | ❓ Ja / Nein Generator | Instant decision generator with visual feedback | entscheidomat.com/ja-nein-generator | | 🎲 Würfel | 3D multi-dice simulator for tabletop games | entscheidomat.com/wuerfel | | 🪙 Münzwurf | Physics coin toss simulation with heads/tails stats | entscheidomat.com/muenzwurf | | 🎱 Magic 8-Ball | Mysterious oracle answer generator | entscheidomat.com/magic-8-ball | | 🏷️ Namen Auslosung | Random name picker, raffle draw & group generator | entscheidomat.com/namen-auslosung | | 🔢 Zufallszahl | Secure random number range generator | entscheidomat.com/zufallszahl-generator |


📦 Installation

# npm
npm install decision-kit

# pnpm
pnpm add decision-kit

# yarn
yarn add decision-kit

💡 Usage Examples

1. Weighted Random Selection ($O(1)$ Alias Method)

import { AliasMethod } from "decision-kit";

const options = [
  { id: "common", label: "Common Loot", weight: 70 },
  { id: "rare", label: "Rare Loot", weight: 25 },
  { id: "legendary", label: "Legendary Loot", weight: 5 },
];

// O(N) setup
const alias = new AliasMethod(options);

// O(1) sampling
const item = alias.next();
console.log("Won item:", item.label);

2. RPG Dice Notation Parser

import { DiceEngine } from "decision-kit";

// Standard notation with modifier
const roll1 = DiceEngine.roll("3d6+2");
console.log(roll1.total); // e.g. 14
console.log(roll1.breakdown); // "[4, 5, 3]+2 = 14"

// Advantage roll (2d20 keep highest)
const adv = DiceEngine.roll("1d20 advantage");
console.log(adv.total, adv.criticalHit);

// Keep highest 3 of 4d6 (character stat generation)
const stat = DiceEngine.roll("4d6kh3");
console.log(stat.breakdown); // "[6, 5, 4, 2] (keep highest 3) = 15"

3. Fair Team & Group Generator

import { TeamBalancer } from "decision-kit";

const members = ["Alice", "Bob", "Charlie", "Dave", "Eve", "Frank"];

// Divide members into 2 balanced teams
const teams = TeamBalancer.divideTeams(members, 2);
console.log(teams);
/*
[
  { id: 1, name: "Team 1", members: ["Charlie", "Alice", "Frank"] },
  { id: 2, name: "Team 2", members: ["Eve", "Bob", "Dave"] }
]
*/

4. React Wheel Spinner Hook

import React from "react";
import { useWheelSpin } from "decision-kit";

const options = [
  { id: "1", label: "Pizza", weight: 1 },
  { id: "2", label: "Sushi", weight: 1 },
  { id: "3", label: "Burger", weight: 1 },
];

export function FoodWheel() {
  const { isSpinning, currentAngle, winner, spin } = useWheelSpin({}, (result) => {
    console.log("Spin finished! Winner:", result.winner.label);
  });

  return (
    <div>
      <div
        style={{
          transform: `rotate(${currentAngle}deg)`,
          transition: isSpinning ? "transform 4s cubic-bezier(0.25, 0.1, 0.25, 1)" : "none",
        }}
      >
        🎡 Wheel Canvas / SVG
      </div>

      <button onClick={() => spin(options)} disabled={isSpinning}>
        {isSpinning ? "Spinning..." : "Spin Wheel!"}
      </button>

      {winner && <h3>Winner: {winner.label}</h3>}
    </div>
  );
}

🖥️ CLI Tool (npx decision-kit)

Make instant decisions straight from your terminal:

# Pick a random winner from options
npx decision-kit pick "Option A" "Option B" "Option C"

# Roll dice
npx decision-kit roll 2d6+3
npx decision-kit roll 1d20

# Flip coins
npx decision-kit flip 5

# Ask Magic 8-Ball
npx decision-kit 8ball de

# Divide group into teams
npx decision-kit team --names "Anna,Ben,Clara,Dan,Erik,Faye" --teams 2

📄 License

MIT © Entscheidomat — Built with ❤️ for decision makers everywhere.