SELECT name
FROM random AS r1 JOIN
(SELECT CEIL(RAND() *
(SELECT MAX(id)
FROM random)) AS id)
AS r2
WHERE r1.id >= r2.id
ORDER BY r1.id ASC
LIMIT 1
SELECT (FLOOR( 1 + RAND( ) *60 ))
1
2
3
4
5
SELECT f.id FROM files f
JOIN ( SELECT RAND() * (SELECT MAX(id) FROM files) AS max_id ) AS m
WHERE f.id >= m.max_id
ORDER BY f.id ASC
LIMIT 1;