RAND is a function and its not effective in big tables, because it does not use indexes.
$query = 'SELECT * FROM gameids ORDER BY RAND() LIMIT 1';
One possible solution is to add column called random
and on every record generate random number for it, then when you are querying the database, order by this column and you'll get pseudo-random but this time using the indexes.
$query = 'SELECT * FROM gameids ORDER BY timestamp, random LIMIT 1';
Edit:
You can also make RAND()
more "flexible" by applying some expression like this RAND() * MAX(numeric_column_name)
If you are interested in optimizations, take a look at this blog post: http://jan.kneschke.de/projects/mysql/order-by-rand/
@Marwelln is correct.