Although the documentation states that it returns strings at random, this is actually not the case.
It returns "selected rows in random order" as it appears in the database without any where / order by clause. This means that it is not random (or randomly selected), as you think, simply because the order in which the rows are returned cannot be determined.
As soon as you click order by x DESC limit 5 there, it will return the last 5 lines of what you select.
To get strings obtained randomly, you will need to use something like: order by rand() LIMIT 1
However, this can affect the speed if your indexes are not configured properly. I usually do min / max to get the identifier in the table, and then make a random number between them, and then select these records (in your case there will be only one record), which is usually faster than having a database work, especially on a large dataset
source share