I don't understand 100%, but it seems your code would show random threads from a different forum (random) each time the block is loaded. What I meant is about a block which, depending on the foum you're browsing (the block should be added on the viewforum page), would show random threads from that forum (so what we need is a code which could be able to identify what forum we're in), or maybe the best rated from it, for instance.
And thanks for your interest anyway...

$_GET array var get the vars given on the url, after the ?
for this url: ...viewtopic.php?f=21&t=5581&highlight=
we have $_GET['f'] = 2;
$_GET['t'] = 5581;
$_GET['highlight'] = ;
And when you write a something, a form, makes vars on the $_POST array.
So forum id is not ramdom, it is given by the f=[FORUM_ID] var at the URL/URI
What is ramdom is the post shown, but I do not know if the code is ok, I made it on a hurry, and perhaps it has to be fixed
