Oh, you are saying you want some to be more rarely chosen than others? Let's say like cards in a deck (like in a board game/collecting game, not poker cards) where there are more of some cards than others.
If so I think MadSpy hit the nail on the head there (except I think flipflopped percentages, 35 should be 45).
Are you familiar with random and choose, the expressions for generating random numbers? (shown by MadSpy above). That is all you need to create any type of randomness you want. After learning about those you just have to really think out how you want the math because you could do it tons of different ways.
For example, here is one thing to think about:
You say you want a common card drawn 45% of the time, uncommon, 35% of the time, and rare 20% of the time. MadSpy's example will do exactly what you want.
That means the following probability of drawing each card:
0: 15% (45/3)
1: 15%
2: 15%
3: 17.5% (35/2)
4: 17.5%
5: 20% (20/1)
So probability wise you will draw common cards most often but the rare card, since you only have one rare card, will be the most commonly drawn card in the game. Not sure you are indenting that . . .
But that is more of a balancing discussion. Like I said, you could set this up so many different ways so what I suggest is you get out pen and paper and write out the math you want. That way you can ask specific questions on how to implement if you get stuck.