in reply to Duplicate Randoms with SSI

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.

Replies are listed 'Best First'.
Re^2: Duplicate Randoms with SSI
by gwhite (Friar) on Oct 26, 2007 at 18:47 UTC

    I have considered having sets of numbers of blocks to pull, I was going to index them on the current seconds (instead of IPs and ENV variables as previously suggested). I tend to add and delete blocks from daily to at least a couple times a month and the number of blocks that are in the text file can inflate or deflate by 15-20 blocks per change. Having to constantly update my chain of numbers seems to defeat the reason to have SSI

    g_White