1.0.2 • Published 11 months ago
weighted-pick v1.0.2
A library to pick random elements with weighted probability
Algorithm Visualization
Usage
const { WeightedValue, WeightedPick } = require('weighted-pick');
const picker = new WeightedPick([
new WeightedValue(0, 1),
new WeightedValue(1, 1)
]);
const n = 1000;
const values = picker.pickValues(n);