0.0.1 • Published 8 years ago
define-probability v0.0.1
define-probability 
Define probability of getting results
Feel free to contribute and improve this lib.
Install
$ npm install --save define-probabilityUsage
const defineProbability = require('define-probability')
const probabilities = [
{ value: 'male', prob: .2 },
{ value: 'female', prob: .8 }
]
defineProbability(probabilities)
// => femaleAPI
defineProbability(entry)
returns value.
entry
Type: array
Required
Array must have at least 2 entries and must have value and prob keys.
Where value is the value returned and prob the probabilities of getting this result. value is a number between 0 and 1.
License
MIT © Bu Kinoshita
0.0.1
8 years ago