....just checked
its a standard SQL select statement with an order by clause of
Code:
order by RAND() LIMIT 32
however there is a note in the MySQL manual that Rand can be a resource hog... we use it to grab 32 images once, not grab a random image for every person.. I suspect this will have a significant performance impact (assuming this is a live requirement and not a piece of homework).