>I can see one problem with this, which is that in the case that you
>get two identical number in the second column their order will be
>strongly dependent on the values in the first column. 

I'm not sure what the problem with this is?  The first (unique) column is
independent of the second (random) column.  If the random column has
duplicate values, it just means that the corrosponding first column values
will be adjacent in the sorted table.  BTW: Does the MySQL sort algorithm
preserve relative positions for rows with duplicate keys?

>I suggest that you generate this table using the normal procedure 
>for randomizing the order of a list, namely that you store the numbers
>to N in an array, pick a random element, insert it into the second 
>column of the table, move the last element of the array to the hole that
>was created in the array, and repeat until the array is empty.

Sure, this will work also.  It appears to be more complicated though, and I
don't see any particular advantage.  That doesn't mean there isn't one of
course!

>Then when you insert values into your own table, just use a regular
>auto_increment id (after all, this id should carry no information,
>except that it identifies a row), and when you want the rows in the
>well-defined but randomized order, join with the two-column table
>and sort on the random number.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to