To be specific, I am suggesting that something like
function f(rng, x)
y = rand(rng)
# ... some complex calculation involving x and y
end
is refactored to
function some_complex_calculation(x, y)
...
end
which is deterministic and can be tested as such.
Eg topics like
The issue is nearly impossible to avoid for reasonably complex calculations.