$ pr=\frac{ (1-\alpha) \alpha^{CW}} { 1- \alpha^{CW} }. \alpha^{-r} $ with $ r=1, ....., CW $. $\alpha$ is parameter we can set between 0 and 1.

Here probability of picking r=1 is very low and r=CW is very high. How can I derive an equation from this equation that should give me values generated between r= 1 and CW with given distribution.

I should get values like this if r=1 to 10. CW=10

10,10,9,9,6,1,6,10,10,3,4 (following geometric distribution from equation provided).

Thanks in advance.