冻结时间以获得相同的随机结果

Freezing time to get the same random outcome

在学习大学第一门编程课程时,我们了解到引入时间作为 rand 函数的种子值,以便在每次代码运行时给出随机值。如果我可以固定时间玩一款每次点击播放时都会提供随机关卡的游戏,我会一直获得相同的关卡吗?如果是的话,有没有办法做到这一点?

如果游戏使用从运行时时间戳播种的伪随机数生成器,那么是的,如果您在每次游戏开始时设法将时间设置为相同的值,那么您应该获得相同的关卡。

可能的方法是拦截对 get system time 系统调用的调用,然后将时间设置为当时的特定值,其余部分保持不变。

您可以尝试使用 IDA Pro (https://www.hex-rays.com/products/ida/) or some other disassembler/debugger. I also found this book an interesting read with respect to hacking with IDA Pro (http://www.amazon.com/Reversing-Secrets-Engineering-Eldad-Eilam/dp/0764574817)

我怀疑您不太可能能够以足够的粒度冻结时间,除非游戏被编码为使用秒而不是毫秒或秒。 Ask it will take is one hardware interrupt from mouse, disk, display network 等来使这不确定。

不要作弊.... ;-)