brianvoe / gofakeit

Random fake data generator written in go
MIT License
4.49k stars 263 forks source link

Generated password does not meet specified criteria #356

Open vivekweb2013 opened 4 months ago

vivekweb2013 commented 4 months ago

The gofakeit.Password function does not seem to produce the a password with specified criteria when the tests are executed in parallel.

For example I have

gofakeit.Password(true, true, true, true, false, 12)

in my parallel tests. The tests verify that provided password contains at-least one uppercase & one lowercase character. The tests are failing intermittently as the generated password sometimes does not include uppercase and lowercase character even if true is specified for the respective parameters.

I think the library only uses the specified sets(uppercase, lowercase, number etc) for generating random password but does not guarantee that chars from these will be included in generated password.

Can we modify the function to add at-least one char from the enabled sets? Or maybe provide another function that does this 🤔

brianvoe commented 4 months ago

Ya i dont disagree with you. Unfortunately the only way to solve your issue is to reloop till it matches or rewrite it in a way that would fit better.