random natural number from range using negative binomial

49 Views Asked by At

How can you extract a random number from a range using the negative binomial distribution?

For example:
the range of possible result values is [1,10]
the probability of success is 0.2

I really don't get it. Doesn't the distribution calculates a probability? How can it be used to get a real number? I know the process should be iterative, incrementing the number of trials, and should use the mass probability function. I really don't know where to start.

Sorry if it's unclear.