dice-rolling
v1.0.1
Published
A fun CLI tool to roll dice and make random decisions from the terminal
Maintainers
Readme
dice-rollinging
🎲 A fun CLI tool to roll dice and make random decisions from your terminal.
Perfect for game development, D&D-inspired projects, or just making decisions the fun way!
Installation
npm install -g dice-rollingUsage
# Basic roll
dice 3d6
# Roll with modifier
dice 2d20+5
dice 4d8-2
# Show statistics
dice 1d20 stats
# Get help
dice helpCommon Notation Examples
1d4- Dagger damage1d6- Mace damage1d8- Longsword damage1d10- Greataxe damage1d20- Standard attack roll3d6- Stat roll (D&D ability score)2d6+2- Fireball with modifier
API
Use it in your JavaScript/TypeScript projects:
import { rollAndSum, getRollStats } from "dice-rolling";
// Roll dice
const result = rollAndSum("3d6");
console.log(result); // { rolls: [4, 2, 5], total: 11, modifier: 0 }
// Get statistics
const stats = getRollStats("1d20");
console.log(stats); // { min: 1, max: 20, average: 10.5, notation: "1d20" }Features
✨ Simple and intuitive dice notation 📊 Statistical analysis of rolls 🎮 Perfect for game development 🚀 Zero dependencies ⚡ Fast and lightweight
License
MIT
