Let's say I have a collection of n objects, and that each object has a ranking associated with it, and these rankings correspond to the integer values 1 through n.
Now suppose that I want to select an object at random from the collection. But I don't want to just pick a number from 1 to n at random; instead I want to make it so that I am more likely to pick a number higher up the list (with a ranking closer to 1).
Proposed solution: Instead of picking from 1 to n, pick from 1 to m, where m is some number significantly larger than n; then use some mapping function f : [1,m] → [1,n] that maps more numbers to the higher rankings than to the lower rankings. For instance, f(1), f(2), f(3) might all return 1, while f(m) is the only one which maps to n, so it is three times more likely to get 1 than n. Hopefully that makes sense.
So my question is: If this seems like a reasonable algorithm, what's a reasonable function f that accomplishes this, and what ratio m/n would be large enough that integer rounding doesn't prevent numbers from never getting picked?
[In my particular scenario, n can be pretty large (in the thousands), so solutions like the one presented here aren't very practical for this situation. Also, the selection is "with replacement"; i.e. I pick an object once and then return; I don't care if I pick it again immediately the next time.]