random-rpg
v1.0.0
Published
Return an array of dice values.
Downloads
19
Maintainers
Readme
random-rpg
Return an array of dice values.
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, then returns an array of dice values.
Install
$ npm install --save random-rpg
Usage
var randomRpg = require('random-rpg ');
// API
// - randomRpg(schema[, options]);
randomRpg('3d10');
// => [1, 6, 9]
randomRpg('5d6');
// => [3, 1, 2, 5, 2]
Optionally specify a sum be returned rather than an array of dice.
randomRpg('3d10', {sum: true});
// => 14
Related
- random-uuid - Return a random uuid.
- random-identity - Return a random ID.
- random-dx - Return a value equal to the roll of a die.
- random-hexhash - Return a random hex hash.
- random-normal - Return a normally-distributed random variate.
- random-rpg - Return an array of dice values.
- random-file - Return a random file name with random extension.
- random-semver - Return a random semver version.
Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please [create an issue](https://github.com/mock-end/random-rpg /issues/new).