Weighted random value generator

0
Remix

Given values with positive weights, write a generator that returns a value at random with probability proportional to its weight. Build it once and answer many calls quickly, and explain how you would test that the output follows the weights.

AmazonTechnical phone screenLast asked Jan 2026
No answer yet. Write the first one; the best answer gets endorsed.