forked from mifmif/Generex
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix range regexes to be uniformly distributed #5
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
263369c to
8ac6af5
Compare
8ac6af5 to
e608081
Compare
RyanLuMaye
reviewed
Sep 25, 2025
NOTES.md
Outdated
| @@ -0,0 +1,12 @@ | |||
| We want to try to match the length of the generated regex with a predefined length of a uniform distribution. Note that this would theoretically only really make the length distribution even, not necessarily the regexes generated. | |||
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| Arguments.of("123a*", 5, 10), | ||
| Arguments.of("a*123", 5, 20), | ||
| // Does not pass test, but isn't a terrible result (biases the middle lengths over the bounds) | ||
| // Arguments.of("(abcde){1,5}", 5, 25), |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| return returnValue; | ||
| } | ||
|
|
||
| // TODO Docs. Discard current match if its > maxLength (indicates invalid match), discard match if its not in bounds, take the match that is closest to target. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
With how the termination condition was being calculated, it was weighed heavily towards the longest length when no max length is provided. A maximum length is now calculated using DFS for any finite pattern.
e608081 to
07d19ee
Compare
RyanLuMaye
approved these changes
Sep 25, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With how the termination condition was being calculated, it was weighed heavily towards the longest length when no max length is provided. A maximum length is now calculated using DFS for any finite pattern and a target length is calculated uniformly.