xaya / libxayagame

MIT License
21 stars 19 forks source link

Allow "branching off" a Random instance #88

Closed domob1812 closed 4 years ago

domob1812 commented 5 years ago

It would be useful to allow deriving a "branched off" Random instance from an existing one and a string key. I.e. use the current seed + the key hashed together as seed for the new Random. This would not affect the state of the existing Random instance.

By having this feature, we could decouple paths in the code of a game logic from each other with respect to the sequence of random numbers. This would allow parallelising things and also allowing easier changes without affecting consensus.

For instance, we could branch off a fresh Random instance before starting the SME match engine for each fixture, and then run the matches in parallel.