What is the structure of the table where you want to pull the online info? Is it a table where you're storing sessions?
It's going to be something like:
$sql = "SELECT *
FROM session_table
WHERE is_online = 1
ORDER BY rand()";
The "ORDER BY rand()" will give you the "unordered" list you want. That's the best I can do without any real details or specifics.