Function that returns integer with specific distribution
问题 I am looking for a distribution or rather a function that returns an integer in a specific range with decreasing probability the higher the number. Lets say the range is from 1 to 5. 85% of the time the function should return 1 8% of the time the function should return 2 4% of the time the function should return 3 2% of the time the function should return 4 1% of the time the function should return 5 Additionally it would be great if the probabilities are according to a set distribution say