virtualc64 icon indicating copy to clipboard operation
virtualc64 copied to clipboard

Replace all calls to rand() by calls to a custom randomizer

Open dirkwhoffmann opened this issue 11 months ago • 1 comments

VirtualC64 calls rand() at multiple places. Although the returned sequences are deterministic, this causes issues in run-ahead mode, since both instances would query different numbers and diverge.

TODO: Implement a new Randomizer class that returns a deterministic pseudo-random sequence and instantiate this class in both the main instance and the run-ahead instance.

Fun fact: Bugs related to run-ahead mode result in funny behavior due to diverging emulator instances. In Barry McGuigan World Championship Boxing, I've thought to have knocked out my opponent.

Bildschirmfoto 2024-03-05 um 17 38 20

However, this only happened in the run-ahead instance. After the next resync, I've been lying on the ground and lost the fight.

dirkwhoffmann avatar Mar 05 '24 16:03 dirkwhoffmann