chance.js
Simplest & smallest random weighted function execution library, so that you can execute weighted functions with ease.
Installation
$ npm install chance.js
Example
var Chance = ; var result = 05: 0 15: 0 20: 0 60: 0; var chance = w: 60 // weight: 60% { // functions can accept arguments result60++; } w: 15 // weight: 15% { result15++; } w: 20 // weight: 20% { result20++; } w: 5 // weight: 05% { result05++; }; for var i = 0; i < 100; i++ chancenext'some arg'; // you can pass arguments; console;