Edit: I was experiencing an issue in which I the probability calculator test, was returning:
Test 3A : .248
Test 3B : .68
I used a roll() method to improve efficiency, rather than creating a new Hat() every single loop.
My results were not correct, and the reason was i forgot to remove the items from the hat each new roll().
For those arriving at a value of 0.248% probability on Test 3A of the Probability Calculator, I strongly recommend you ensure you are removing elements from the hat.
I don’t even know what this sentence means - but I also don’t know who in the world can look at 1000 lines of examples and be like “Ah yes, I clearly see something in ALL OF THEM”.
People surely want to plagiarize your failing code and couldn’t just type into the search-console and propably find 5 other topics linking to finished projects… ^^°
Also how exactly do you expect help, without showing off your code?
I created a function called “reset” and saved the hat-content in two seperate arrays - after every roll I called resett and turned the hat-content back to it’s original state.
By the way, you approach will fail for one simple reason: One test checks if after a roll the hat.content has changed.
We could see this, if you’d posted the error message or even your project, instead you are lucky I remember it because many people (including myself) struggled to do that while also allowing multiple-draws.
Edit: I see you found the error yourself. I’m glad but this topic is really confusing O.o
Thank you for your help.
In the heat of frustration, it can be hard to escape the tunnel vision of wanting a solution.
I have updated the post for future users to be helped by this question, and my future posts will be more concise, and have code snippets as well, as I too would have found this answer useless.
Plagiarism is unlikely. I agree.
Code snippets in the future. Agreed.
Your sarcasm was rude and unnecessary, please leave it out of your posts to future users please. You are not helping contribute to growth in the community by putting others down.
Thank you for taking the time to read it, and I wish you the best in your coding adventures.