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.



Colin Guthrie

Day Job:
  Tribalogic Limited []
Open Source:
  Mandriva Linux Contributor []
  PulseAudio Hacker []
  Trac Hacker []

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to