faker
faker copied to clipboard
Faker::Alphanumeric.alphanumeric determinism fix
Motivation / Background
This Pull Request has been created because the Faker::Alphanumeric.alphanumeric
generator is not deterministic when using min_alpha
and/or min_numeric
.
Additional information
The generator is not currently deterministic when setting a custom Faker::Config.random
due to the usage of the standard shuffle
array method.
Unfortunately, this can't be caught by the tests in test/test_determinism.rb because the default keyword arguments do not trigger the non-determinism due to the early return when both min_alpha
and min_numeric
are 0
.
I have added a test to the Faker::Alphanumeric
test file for this case, but I'm happy to [re]move it if preferred.
Checklist
Before submitting the PR make sure the following are checked:
- [x] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
- [x] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex:
[Fix #issue-number]
- [x] Tests are added or updated if you fix a bug, refactor something, or add a feature.
- [x] Tests and Rubocop are passing before submitting your proposed changes.
If you're proposing a new generator or locale:
- [x] Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.
- [x] You've reviewed and followed the Contributing guidelines.