Resolving Nondeterminism Problems
Here are some problems with nondeterminism that we've run into, and solutions we've used for C objects. These solutions are applicable to Java objects.
- If the program uses a random number generator, fixing the seed can make it deterministic.
- If the program uses dates or terminal ids or other information that differs from run to run, replace output statements for such information with output statements that print deterministic placeholder strings.
- If a program uses the Ant packaging build system there are non-deterministic outputs (date stamps) that can be eliminated by using the version we provide under the Download Tools link. Similarly, JUnit can also produce date stamp non-deterministic output and under the Download Tools link we provide a version that eliminates these as well. Feel free to discover what we have modified in these versions of Ant and JUnit and apply similar changes to the most recent versions of these if you wish.
Note that threads can and probably will cause nondeterminism problems. Further investigation will be performed on this issue, but for the time being objects that utilize multi-threading in a manner that results in non-deterministic outputs are probably not suitable for most experimentation.