I want to generate a number based on a distributed probability. For example, just say there are the following occurences of each numbers:
Number| Count
The general approach is to feed uniformly distributed random numbers from 0..1 interval into the inverse of the cumulative distribution function of your desired distribution.
Thus in your case, just draw a random number x from 0..1 (for example with Random.NextDouble()) and based on its value return