Simple priority queue picking items based on weight driven probability.
Installation
npm install --save probability-queue
Usage
const ProbabilityQueue = ; let pq = 'score'; pq;pq;pq;pq; let names = 'Alice': 0 'Betty': 0 'Clara': 0 'Diana': 0;forlet i=0; i<1000; ++i namespqname += 1;console;
Script above should produce output similar to:
{ Alice: 108, Betty: 402, Clara: 292, Diana: 198 }