@randsum
is a powerful collection of dice-rolling utilities. You can roll common dice with @randsum/dice
:
import { D20 } from `@randsum/dice`
// Roll a single D20
D20.roll()
// Roll 4 D20
D20.rollMany(4)
Or compose powerful rolls with multiple dice and modifiers using @randsum/tower
:
import { roll } from `@randsum/tower`
// Roll 4 D6 and 2 D20
roll({quantity: 4, sides: 6}, D20)
// Roll 4 D6, drop the lowest, and roll three d8
roll({ quantity: 4, sides: 6, modifiers: { drop: { lowest: true } } }, {quantity: 3, sides: 8})
Validate and manipulate dice notation with @randsum/notation
:
import { validate, DiceNotation } from `@randsum/notation`
const { valid } = validate('4d6L')
const notation: DiceNotation = `4D6!` // valid
const badNotation: DiceNotation = `4X2` // invalid
...and more!