1

**General / Re: Different Results**

« **on:**September 22, 2023, 11:55:20 AM »

For those who found this topic on google - why this is not always possible to have reproducible results in an algorithm:

1) If the algorithm is single-threaded - it is enough to fix the seed for the random values generator, so that the random sequence is the same from run to run (on the same computer).

2) If the algorithm is multi-threaded, you can't easily mitigate possible differences in threads execution speed. In general, you can only mitigate it with algorithm speed degradation - f.e. falling back to single-threaded implementation. And the possible difference in threads' execution speed leads to different results.

1) If the algorithm is single-threaded - it is enough to fix the seed for the random values generator, so that the random sequence is the same from run to run (on the same computer).

2) If the algorithm is multi-threaded, you can't easily mitigate possible differences in threads execution speed. In general, you can only mitigate it with algorithm speed degradation - f.e. falling back to single-threaded implementation. And the possible difference in threads' execution speed leads to different results.