Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More

rpg

// usage randBox.rpg('#d#') randBox.rpg('#d#', {sum: true})

Given an input looking like #d#, where the first # is the number of dice to roll and the second # is the max of each die, returns an array of dice values.

randBox.rpg('3d10'); => [1, 6, 9] randBox.rpg('5d6'); => [3, 1, 2, 5, 2]

Optionally specify a sum be returned rather than an array of dice.

randBox.rpg('3d10', {sum: true}); => 14
Last updated on: