Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Duplicate Randoms with SSI

by dwm042 (Priest)
on Oct 26, 2007 at 17:00 UTC ( [id://647438]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://647438]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2026-01-14 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.