Closed thomas-pemsel closed 2 years ago
Don't forget to Linking a pull request to an issue using a keyword 😉
X-L-ent start! Hmmm, how do we test random 🤔? I start thinking out loud ... well ... silent ... I press some keys on my board:
Do we need an IRandom
interface with the Random
methods currently in use, and implement a production SystemRandom
or DefaultRandom
which proxies a System.Random
, and then a TestRandom
or FixedRandom
, where we put in an array, or collection of numbers serving as the predefined sequence of next random numbers 🤔.
Or, we derive directly from Random
.
So, I implemented the things that @Flash0ver mentioned, so I guess this PR is now official-ly ready to review ;) I even went through the Fisher Yates shuffle algorithm manually to construct two of the test cases. Here's a screenshot of my notes for this: 😅
Here it is, a quick little Pull Request for other Shuffler algorithms 😉 I create this as a draft Pull Request as I would like to test out if I can pre-seed the randomness in these algorithms so that I can write unit tests for them. But you can have a look over the structure and how it fits into the code. Closes #65