In MySQL, you can select X random rows with the following statement:
SELECT * FROM table ORDER BY RAND() LIMIT X
This does not, however, wo
This one solves the negative RANDOM integers, and keeps good performance on large datasets:
SELECT * FROM table LIMIT 1 OFFSET abs(random() % (select count(*) from table));
where: abs(random() % n ) Gives you a positive integer in range(0,n)
abs(random() % n )
range(0,n)