SELECT name
FROM random AS r1 JOIN
(SELECT (RAND() *
(SELECT MAX(id)
FROM random)) AS id)
AS r2
WHERE r1.id >= r2.id
ORDER BY r1.id ASC
LIMIT 1;
While looking up optimization for MySQL, I have came up with this query. But, it doesn't entirely serve my purpose because I want to pull random users from my database, but I also have a field for active. So I want to ensure that "active = 1", but I'm not sure where I would plug that into this query to make it work.