两种不同结果类型的随机顺序? [关闭]

I have two types of ads. Paid and free. When a zip code is queried all the matching ads are returned along with a designation of free or paid. I want to show the paid ads first, then the free ads next. This is simple enough, but is there a way to randomize the display order for each type separately? A single random sort would place some free ads before some paid ones.

This is the most generic form of the kind of query you need:

SELECT *
FROM the_table
ORDER BY [some_type_field(s)], RAND()
;