Here is the Code:
function generateRandomNo ($length)
{
 $output = "";
 $options = "0123456789abcdefghijklmnopqrstuvwxyz";
 $count = 0;
 while ($count < $length)
 {
  $char = substr($options, mt_rand(0, strlen($options)-1), 1);
  if (!strstr($output, $char)) {
   $output .= $char;
   $count++;
  }
 }
 return $output;
}





