Weighted random SQL query

Miscellaneous Forums/General Discussion/Weighted random SQL query

Im sure I recently saw an example of selecting some random rows in mysql and it didnt order by a row but did pretty much what Indiepath is doing. So.. if its MySql then it looks OK I think in terms of syntax.

SELECT col1, col2 from table1 where col3='x' order by Rand() LIMIT 1

So.. Rand() is a float between 0 and 1. Mainweight is ??... an int ?.. and is it the smaller the mainweight the more likely you want it to be selected ?

If yes then it looks like it should do what you want.