I have a list of integers and I would like to be able to choose a random number based on the weights in a that list.
For example let's say I have a list like this: List = [20,40,80,60]
.
The chances of me choosing the number 1 (or 0 depending on how you see it) would be 10% and the chance of getting the number 3 would be 30%.
How would I go about doing this in a pythonic way?