improved password generation algorithm in reset password