-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generator never hits uppercase 'A' #25
Comments
There is a file containing result of 500 calls |
I've run into this issue as well. In fact, It happens even with digits. For example: I think I've discovered more about the issue. It seems that it is dropping the character with the lowest ASCII value from the list of character choices. So if you run this:
|
I'm pretty sure that the error lies in line 84 of /dist/password-generator.js: The return from this function is used to select a character from a zero-based array. However, "value" can never be zero because "min" is zero; and 0 is not less than 0 (ever). I think that line 84 should be changed to: |
Thanks @ADIOP55550 for reporting this and @fshields for finding the solution to the bug. I was able to confirm it with a test case and pushed a fix to npm as 2.2.2 |
I'm pretty sure that there is some kind of bug, that prevents capital A from appearing in passwords.
I've run this command:
password-generator -c -l 50 -p "[a-zA-Z]"
around 500 times and not a single 'A' appeared.Here are some example results i ran into when I was examining this:
Moreover, it also affects other capital letters if they're only one in the pattern:
Also, giving it one letter as pattern generates "Maximum call stack size exceeded" error.
All those generate this error:
password-generator -c -l 50 -p "[A]"
password-generator -c -l 50 -p "A"
password-generator -c -l 50 -p "[a]"
password-generator -c -l 50 -p "a"
But that may be working as intended, because of required at least 2 characters in the pattern for some randomness.
And a screenshot from console:
The text was updated successfully, but these errors were encountered: