This could be a solution:
$num = 10; //number of pseudo-random numbers
$max = 1000; //largest acceptable pseudo-random number
mt_srand((double)microtime() * 1000000);
$rand_array = array();
for ($i = 0; $i < $num; $i++) {
do {
$n = mt_rand(0, $max);
} while (in_array($n, $rand_array));
$rand_array[] = $n;
}
I do believe that it will run an infinite loop if $max < $num though, so you may need to add a check.