If you participate in affiliate programs, you may want to put several ads of your advertisers in some standard area of your pages, like a bottom bar or side area. However if you have more advertisers to put there than space you may want to rotate their banners This is also a good idea, because if banners change with each reload, they get more attention.
A simple solution to that would be to select randomly M (how many fits into area) different banners out of N (how many advertisers you have). That's not a rocket science, but still a need to make them different makes it a bit more complex than just to shoot M times random number generator. Here is a simple solution which will work for up to 32 advertisers. If you have more, you'll have to replace bit mask with a boolean array.
And here is an example how to do that:
Reload this page and see the numbers change. We specially kept border for this table, so you'll see it. In your real-life bar you may want to sent "border=0".
And here is the code to implement this: