I have a dictionary that looks like this.
mychoice = {0.7: 2, 0.2: 1, 0.1:3}
I will use the following to select which value to use. In the above, value 2 will be selected 70% of the time and value 1 will be selected 20% of the time and 3, 10% of the time.
What is the best method to use the following to generate a random number between 0 and 1 and to select randomly the value to use?
from random import random
ran = random()
if ran>.10 and <.30 then select value 1 with a key of .20
Thanks