Collection class in Javascript implementing weighted random sampling using the roulette method