Weighted Round-Robin Arbiter
Generate array indices with round-robin distribution, weighted by given scores.
Usage
The package exposes a factory function which takes an array of weight scores and returns the arbiter function.
const wror = next = counts = 0 0 0 order = for let i = 0; i < 10; i++ let n = counts n ++ order consoleconsole
The result will be the following:
[ 2, 5, 3 ]
1112120120
Installation
With npm:
npm install wror
Tests & benchmarks
Run unit tests:
npm test
Run unit tests and create coverage report:
npm run cover