Added birthday collision simulation example#3
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new runnable Monte Carlo example (BirthdayCollisionSimulation) to the simulation.examples package, updates the README to reference/run it, and ignores macOS Finder metadata.
Changes:
- Introduce
BirthdayCollisionSimulationexample that estimates birthday-collision probability across multiple trial counts. - Add JUnit 5 unit tests covering constructor validation, core collision logic, and estimate behavior.
- Update
README.mdusage examples and extend.gitignorefor.DS_Store.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/main/java/simulation/examples/BirthdayCollisionSimulation.java |
New example simulation implementing repeated trials using the existing discrete-event engine. |
test/java/simulation/examples/BirthdayCollisionSimulationTest.java |
New unit tests validating input checks and probabilistic estimate behavior with seeded RNG. |
README.md |
Documents running the new example and adjusts suggested first tasks accordingly. |
.gitignore |
Adds macOS .DS_Store ignore entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jody
commented
May 2, 2026
Contributor
Author
jody
left a comment
There was a problem hiding this comment.
Manual cleanup of AI generated simulation model for birthday collision problem
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+271
to
+276
| output="html" | ||
| outputFile="${reports.dir}/spotbugs.html" | ||
| effort="max" | ||
| reportLevel="low" | ||
| reportLevel="medium" | ||
| jvmargs="-Xmx512m" | ||
| failOnError="true" | ||
| failOnError="false" |
Comment on lines
+274
to
+276
| reportLevel="medium" | ||
| jvmargs="-Xmx512m" | ||
| failOnError="true" | ||
| failOnError="false" |
| * @param seed specific seed value for random source of random birthdays | ||
| * @throws IllegalArgumentException if {@code groupSize} or {@code trialCount} | ||
| * is less than one | ||
| * @throws NullPointerException if {@code random} is {@code null} |
| new BirthdayCollisionSimulation(23, 10_000, 2026L); | ||
|
|
||
| simulation.run(); | ||
| System.out.println(simulation.getEstimatedProbability()); |
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
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.
Created a "Birthday Collision" simulation example and updated the README.
Also added macOS specific files to .gitignore.