Not sure about the time issue. I would think setting a variable to date("r") and checking against however long you want, or making a time and calculating the difference.
As for the questions:
Make a function out of the rand(1,1000).
Then, when a random question is chosen, see if it's ID is already in an array, and if so: run another, if not, display it.
Pseudo code. Not guarantted to work!!
<?php
function rand_q()
{
$q_id = rand(1,1000);
}
if(in_array($q_id, $displayed))
{
rand_q();
}
else
{
$displayed[] .= $q_id;
// DIsplay question here
}
?>
~Brett