¿¿por que no usar las funciones existentes??
   Código PHP:
    $foo = substr(md5(mt_rand() / .2), 0, 6); // 6 caracteres
$foo = substr(uniqid(''), 0, 6); 
    
  etc, etc.... 
o algo mas personalizado  
 Código PHP:
    $max = 6;
$foo = null;
$chars = 'abcdefghjkmnpqrstuvwxyz-_[]'
            .  'ABCDEFGHJKLMNPQRSTUVWXYZ'
            .  '23456789'; // permitidos
for ($i = 0; $i < $max; ++$i)
{
  $foo .= substr($chars, rand(0, strlen($chars)), 1);
}
// pass = $foo