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

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

 



Thanks everyone for responses.

'Twas brillig, and Nathan Rixham at 20/08/10 13:17 did gyre and gimble:
> if you use mysql you can seed rand() with a number to get the same
> random results out each time (for that seed number)
> 
>   SELECT * from table ORDER BY RAND(234)
> 
> Then just use limit and offset as normal.

This is a neat trick! Yeah that will avoid the need for the static
lookup table with 32 randomised columns.

Jon's strategy is more or less a simplified version of my 32-column
randomising table (i.e. just have 1 column of random data rather than
32). I would personally prefer to reduce the refresh of this data as I
don't like to annoy people when the change over day happens.

The RAND(seed) approach will probably work well (not sure of performance
verses an indexed table, but I can easily experiment with this).

If I use the numbers 1..32 as my seed, then I still get the same net
result as a 32 column table. If I just change my "seed offset" then I
get the same result as re-generating my random data tables.

>From an operational perspective, RAND(seed) is certainly easier.

I'll certainly look into this. Many thanks.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


-- 
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