-
Notifications
You must be signed in to change notification settings - Fork 0
RandomGenerator extending java.util.Random with richer generators. #106
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
Conversation
Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends java.util.Random by adding richer generator methods to support random selection from arrays, collections, enums, and generating random strings, along with the corresponding tests.
- Introduces new methods in RandomGenerator.java such as nextValueFrom, nextValueExcept, nextString, and shuffleCharacters.
- Adds comprehensive tests in RandomGeneratorTest.java to validate behavior across different data types.
- Introduces ExampleEnum.java for testing enum generation.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/nl/talsmasoftware/misc/utils/RandomGenerator.java | Implements richer random generator methods and updates Javadoc comments. |
| src/test/java/nl/talsmasoftware/misc/utils/RandomGeneratorTest.java | Adds tests covering the new random generation functionalities. |
| src/test/java/nl/talsmasoftware/misc/utils/ExampleEnum.java | Provides a sample enum for testing nextEnum method. |
Comments suppressed due to low confidence (1)
src/test/java/nl/talsmasoftware/misc/utils/RandomGeneratorTest.java:111
- [nitpick] The variable name 'lengte' is in a different language than the rest of the code; consider renaming it to 'length' for consistency.
final int lengte = 5 + RND.nextInt(10);
src/main/java/nl/talsmasoftware/misc/utils/RandomGenerator.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces a new RandomGenerator class that extends java.util.Random with richer generators and convenience methods such as nextEnum, nextString, and nextValueExcept. It also adds comprehensive tests for these new methods as well as an example enum for verifying enum-based random generation.
- Added RandomGenerator.java with additional random generator methods.
- Added RandomGeneratorTest.java to validate the new functionality.
- Introduced ExampleEnum.java for testing nextEnum.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/nl/talsmasoftware/misc/utils/RandomGenerator.java | Implements additional generator methods, including methods to generate enums, strings, and values excluding specified entries. |
| src/test/java/nl/talsmasoftware/misc/utils/RandomGeneratorTest.java | Provides extensive tests for the new methods. |
| src/test/java/nl/talsmasoftware/misc/utils/ExampleEnum.java | Supplies an enum needed to test the nextEnum method. |
Comments suppressed due to low confidence (1)
src/test/java/nl/talsmasoftware/misc/utils/RandomGeneratorTest.java:79
- [nitpick] The variable name 'alleWaarden' is in Dutch while other variables are in English. Consider renaming it to 'allValues' for consistency.
Iterable<String> alleWaarden = list::iterator;
src/main/java/nl/talsmasoftware/misc/utils/RandomGenerator.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
|



No description provided.