Translation to PHP, from the answer posted ny Dan McGrath. rand7(){$x=8;while($x>7)$x=rand5()+5*rand5()-5;return $x;} 58 characters.