npm.io
1.0.0 • Published 10 years ago

random-rpg

Licence
MIT
Version
1.0.0
Deps
1
Vulns
0
Weekly
0

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

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