A random with ratio?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

A random with ratio?

Post by Phoenixheart »

Hello,

I'm developing an ad-rotator system, in which the user has 4 levels of ads:
- Bronze: displaying ratio is 5%
- Silver: 25%
- Gold: 50%
- Platinum: 75%

So, a "gold" ad will have a better chance to be displayed than that of "silver" ones, and so on.
I'm not very good at mechanism, so would highly appreciate if someone could give me a hint on how to do it :)
Thanks in advance!
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: A random with ratio?

Post by VladSun »

There was a big topic regarding this issue:
viewtopic.php?f=2&t=76771&hilit=weight+random
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply