$a = range(1,39); shuffle($a); while(++$i == 34) unset($a[rand(1,39)]);