The function where the probability that at least one person has the same birthday as another should have another parameter that indicates the number of runs instead of making the user figure out how many runs are needed. Different probabilities require a different number of runs. For example, for a probability close to 0% or 100% only a few runs would be needed, whereas for probabilities around 50% has a lot more variance (according to Wikipedia. Therefore, it would require a lot more runs. Also, the tests for this function should be testing with a lower and upper bound. These bounds should be based on a statistical analysis (done offline, of course) that would result in the test passing with a high probability (let’s say 99.9%) if the exercise is solved correctly.
canonical-data.json specifies
The expected probability values should be compared using some tolerance to allow for small deviations.
Note that the probability can be calculated without needing any runs.
For students that do use runs, the various tracks widely vary in performance, so a suitable number of runs (and therefore appropriate tolerance) could vary between tracks. canonical-data.json could only give informal guiance.
@keiraville OK, I guess that makes sense, but I’m not sure why someone would try to calculate the actual probability when the exercise focuses on generating random birthdates and determining if there are any shared birthdays. Also, canonical-data.json line 6 implies that a random answer is returned from the function under test.