A problem of course is if the three numbers returned by rand() contain duplicates. It's more reliable to use array_rand() instead.
You should have some unique key in your table - select all the values for that field and then use array_rand() to pick out your sample. You can get back all the sampled rows with one query if you use a WHERE clause like "id IN (...)" and put a comma-separated string of your selected ids in the ().