1.0.0 • Published 8 years ago

random-rpg v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

random-rpg

MIT License

build:? coverage:?

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

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).