You can use RandomPassword function;
<?
function RandomPassword($passlength) {
$chars = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
$chars .= “1234567890″;
$chars .= “abcdefghijklmnopqrstuvwxyz”;
$charsLength = strlen($chars);
for ($ras = 0; $ras <$passlength; $ras++) {
$number = rand(0,$charsLength-1);
$password .= $chars[$number];
}
return $password;
}
echo $RandomPassword(8);
?>
See demo
To generate random number between 0-1000 try this;
srand((double)microtime()*1000000);
echo rand(0,1000);
The above example will output something similar to:
891