PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
648 stars 60 forks source link

Adds unit tests to assure randomness #770

Closed hobnob closed 2 weeks ago

hobnob commented 1 month ago

Tests now run 3 lots of 200,000,000 rolls of dice and check the distribution of the results in order to test the assertion made in #750

There's a minor code cleanup here too, but nothing breaking (just re-using a method rather than having 2 similar methods)

davesmith00000 commented 3 weeks ago

There's a lot of good stuff in here that I don't want to lose, however there are two points to have another think about:

  1. The discussion on the issue has continued and needs review.
  2. I'm not sure about the Date change made here.

Dice are supposed to be 'predicatably unpredicatable'. By salting the seed with the initial date, I feel like we lose a bit of that. Now, I don't know in practice if it makes a great deal of difference: Is anyone really testing that way? Seems unlikely, but I'm also not sure if adding the date will improve the issue being reported. If not then it's an arbitrary change we don't need.

davesmith00000 commented 2 weeks ago

Branch needs a rebase.

hobnob commented 2 weeks ago

Done :)