Hey there,
I am pretty new to Rust and just managed to write a program that seems to behave non-deterministically. Sometimes it provides the correct result, but sometimes, it does not. I am not using unsafe
or any concurrency in my code. Presumably, this behavior is rooted in my usage of HashMap
s and HashSet
s. Do you have any tips on how to debug such problems? Is there a way to fix the seed used for hashing such that I can get reproducible results and track down the problem?
To provide you with a bit more context: I am working with Markov Decision Processes (MDPs) and essentially read a description of an MDP with variables from a JSON file using Serde. This description is then turned into a more efficient representation following Building fast interpreters in Rust. The program then explores the entire state space of the MDP and returns the number of states. Unfortunately, this number changes between multiple executions (producing what seems to be a finite set of wrong results and sometimes the correct state count).
Cheers,
Maximilian