Python: Selecting numbers with associated probabilities [duplicate]
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: Random weighted choice Generate random numbers with a given (numerical) distribution I have a list of list which contains a series on numbers and there associated probabilities. prob_list = [[1, 0.5], [2, 0.25], [3, 0.05], [4, 0.01], [5, 0.09], [6, 0.1]] for example in prob_list[0] the number 1 has a probability of 0.5 associated with it. So you would expect 1 to show up 50% of the time. How do I add weight to