This is technically a programming-related question, but the actual answer will most likely be a mathematical formula, and the question can be understood with no programming knowledge, so I decided not to put it in stackoverflow.
I'm making an advertising feature on a website, and the idea is if you pay more, the advertisement is more likely to show upon each page load.
For example, if Bob payed 1 thousand, and Jim paid 500, Bob's advert is twice as likely to be shown.
Given this information how could I work out which advert to show, with any number of adverts running at once? (The selection is random, in the scenario above, there's a 2/3 chance of Bob's and 1/3 change of Jim's showing. That's rather easy but imagine we had 1,000 adverts running)
Note that one advertisement may be running at once.