Floating-point math may be deterministic, but the ordering of dictionary keys is not.
When you call .keys()
, the order of the resulting list is potentially random.
Thus the order of your math operations inside the loops are also potentially random, and thus the result is not going to be deterministic because while any single floating-point operation might be deterministic, the result of a series of operations is very much dependent on ordering.
You could enforce a consistent order by sorting your key lists.