RE: Dear Lazy Web: Pseudo Randomisation Strategies on Listing Websites

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Col,

Interesting problem.

> Are there any other approaches I've missed? 

Off the top of my head, how about this:

1. Add a new unsigned int column called "SortOrder" to the table of widgets
or whatever it is you're listing

2. Fill this column with randomly-generated numbers between 0 and whatever
the unsigned int max is (can't remember exactly but 4.2 billion ish)

3. Add the SortOrder column to the end of all your ORDER BY clauses - SELECT
foo ORDER BY TypeOfListing, SortOrder will give you widgets sorted by
Gold/Silver/Bronze type, but in a random order for each type

4. Every hour/day/week/whatever, update this column with different random
numbers

Advantages: practically no hassle/overhead/maintenance for you; provides
same ordering sequence for all users at the same time; only breaks "third
one down"-type references when you refresh the SortOrder column rather than
on each session or page view; reasonably proxy- and cache-friendly
especially if you send a meaningful HTTP Expires header.

Disadvantages: breaks user persistence if they visit before and after a
SortOrder refresh ("I'm sure the one I wanted was at the top of the list
yesterday..."); more effort to demonstrate randomness to the client ("OK,
see how you're in ninety-third place today? Well, check again tomorrow and
you should be somewhere else on the list").

Hopefully food for thought anyway.

Cheers
Jon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux