I think the best way would be to retrive a count of the number of questions in one group and then generate a random number to select one.
Something like this in mysql.
<?
$query="select ID from database where group like '1';";
$result=mysql_query($query, $connection);
if ( !$result )
{
echo "Failed to execute query<P>\n";
echo mysql_error();
exit;
}
unset($store);
while ( $fields=mysql_fetch_array($result) )
{
$store[]=$fields[0];
}
$top=count($store);
$touse=mt_rand(1, $top);
echo "Using question ".$touse;
// $store[$touse] then holds the id of the question to use.
?>