> a simple way would be to : $pass = $allowable_characters[mt_rand(0,$ps_len-5)] for($i = 0; $i < ($length -2); $i++) { $pass .= $allowable_characters[mt_rand(0,$ps_len-1)]; } $pass .= $allowable_characters[mt_rand(0,$ps_len-5)] // This variable contains the list of allowable characters // for the password. Note that the number 0 and the letter // 'O' have been removed to avoid confusion between the two. // The same is true of 'I' and 1 > btw, you didn't implement this. hope this helps ramil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php