Write a function that given a list of items and weights return a random item in the list taking the weights into account.
The solution really depends if this is a one shot or a repeated call implementation.
The code actually had a bug on the first cut. If the rnd is in the function, values will repeat because multiple calls may happen in the same RANDOM interval for the seed. The solution was to use an external Random so each .Next would work onwards from the original seed.
Testing code is simple:
We repeat the procedure with a given distribution and see what the results are. We would expect 9000, 900 and 100.