Should throw instead of returning "Try again" when a valid password cannot be found
Can the call to .Next() throw instead of returning a password called "Try again" when a valid password could not be generated in maximumAttempts?
I think it's a big risk to return a string like that as the calling application has no way to know what was returned is not a valid password.
A dedicated exception type would be a bonus.
password = PasswordIsValid(Settings, password) ? password : "Try again";
Indeed, you either throw exception or use TryXXX pattern
bool TryGenerate(out string password)
@clement128 good idea, but I decided to go with a dedicated exception type. Mainly because I did not want to break backwards compatibility with this project in my fork.
I actually don't see why you could not guarantee password generation with every call. you might need to tweak the algorithm but I really cannot fathom any reason why it would not be possible... :/