random-outcome

1.0.0 • Public • Published

random-outcome

Pick a random outcome given a distribution.

install

npm install random-outcome

usage

var randomOutcome = require('random-outcome');
 
var outcomes = {
    'left': 0.2,
    'right': 0.4,
    'forward': 0.2,
    'back': 0.1,
    'stay': 0.1
};
 
console.log(randomOutcome(outcomes));
// => left
 
console.log(randomOutcome(outcomes));
// => right

license

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1

Package Sidebar

Install

npm i random-outcome

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kizerkizer