Truly random numbers should contain periods with repeats. Therefore, you don't want truly random numbers. You want a nonrandom function with a period as long as the number of ads you serve, whose values map 1 to 1 to your ads for the length of the period. The piece of code that generates this function has to be persistent.
By way of example, if you have 10 ads, you could start with an array of numbers, 1 through 10 which you would then shuffle. Each number would map to an ad, and then use your 'persistent' piece to hand the required content to the display code. When the server piece gets to the end of the array it starts over. After serving up so many ads, it reshuffles the array of ad-order (so that people don't see too common a pattern).
Your persistent piece could be a separate process, using sockets or a fifo for communication or simply a file that is read that contains an index. You would increment and update the index after each use.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.