Here is a function I use to generate random passwords. I imagine you could use something similar to generate random filenames.
#Generates a random password
function generate_passwd($length = 50) {
#all the chars we want to use (excluding 0,l,v, etc. and other confusing chars)
$all = explode(" ",
"a b c d e f g h j k m n p q r s t w x y z "
."A B C D E F G H J K L M N P Q R S T W X Y Z "
."2 3 4 5 6 7 8 9");
for ($i=0;$i<$length;$i++) {
srand((double)microtime()*1000000);
$randy = rand(0, 61);
if ($all[$randy]!=" ") {
$pass .= $all[$randy];
if (strlen($pass)>5){
return $pass;
}
}
}
}