← Code LabNode.js0/50 solved · 0%
Patterns · medium

29. Weighted Random Pick

Select an item based on weight.

Write `pick(items)` where items are `{ val, weight }`. Sum weights, pick by ratio.
Required in your answer: reducethreshold