@randsum/roller
Version:
A flexible, type-safe dice roller for tabletop RPGs, game development, and probability simulations
54 lines (42 loc) ⢠1.93 kB
Markdown
<div align="center">
<img width="150" height="150" src="https://raw.githubusercontent.com/RANDSUM/randsum/refs/heads/main/icon.webp" alt="Randsum Logo. A Dotted D6 rolled a 6 with the dots arranged to look like an R.">
<h1>@randsum/roller</h1>
<h3>Advanced Dice Rolling for JavaScript & TypeScript</h3>
[](https://www.npmjs.com/package/@randsum/roller)
[](https://bundlephobia.com/package/@randsum/roller)
[](https://www.npmjs.com/package/@randsum/roller)
[](https://github.com/RANDSUM/randsum/blob/main/LICENSE)
[](https://www.npmjs.com/package/@randsum/roller)
</div>
A flexible, type-safe dice rolling implementation for tabletop RPGs, game development, and probability simulations that supports:
- š² Standard dice notation (`4d6`, `2d20H`, etc.)
- šÆ Complex modifiers (drop lowest, reroll, exploding dice)
- š Full TypeScript support with intelligent type inference
- š® Perfect for games, RPGs, and simulations
- šŖ¶ Tree-shakeable implementation for minimal bundle size
- š¦ Optimized for performance and reliability
- š§© Extensible architecture for custom game systems
- š Works in Node.js, browsers, and React Native
## Installation
```bash
npm install @randsum/roller
# or
yarn add @randsum/roller
# or
bun add @randsum/roller
```
## CLI Usage
Roll dice directly from your terminal:
```bash
npx randsum 2d20 # Roll two twenty-sided dice
npx randsum 4d6L # Roll 4d6, drop lowest
npx randsum 3d8+2 # Roll three d8s and add 2
```
Example output:
```text
š² Roll Result:
āāāāāāāāāāāāāāā
Total: 24
Rolls: [14, 10]
Description: Roll 2d20
```