1.0.0 • Published 9 years ago
random-outcome v1.0.0
random-outcome
Pick a random outcome given a distribution.
install
npm install random-outcomeusage
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));
// => rightlicense
MIT
1.0.0
9 years ago