Skip to content
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

Fixed issue 584 #613

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fixed issue 584 #613

wants to merge 2 commits into from

Conversation

Zhang-Muyang
Copy link

Fixed issue 584.
The problem is described in the issue. The reasons are as follows.

  1. In original code, a special character may replace a digit, which leads to no digits.
  2. The loop of special character may only iterates once, which generates no special character.
  3. In the character function in Lorem, digits and letters are chosen randomly from array character which contains all letters and
    digits. But there could be chances that all character chosen are letters, no digits.
  4. Similar to 3), there could be no upper letter in small chances.

The fix is:

  1. Add a Test which is mainly copied from the issue description.
  2. Overload the character function in Lorem. Its idea is: We choose the special, digit, upper letter first, which ensures we can defintely contain these. And then randomly choose the rest. Shuffle the characters array in the end.

Plus, feel free to contact with me if there is any problem. : )

Zhang-Muyang added 2 commits April 17, 2021 15:50
Fix issue 584
fix character
@Zhang-Muyang
Copy link
Author

Zhang-Muyang commented Apr 19, 2021

Fix #584

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant