2 ms·
A throw of dice will demonstrate the fact that we shouldn't care about bugs in models caused by race conditions? How does that even make sense?
by smsm42 7y ago
A throw of dice will demonstrate the fact that we shouldn't care about bugs in models caused by race conditions? How does that even make sense?
- rovolo 7y agoThe "race condition" is that the random numbers fed to each thread are nondeterministic given a specific seed. Even though a specific run can't be reproduced due to the nondeterminism, the random values aren't causing math bugs. Let's say we are doing a stock market simulation. You have 2 shares of company A and 5 shares of company B. Your profit depends on the change in share price. srand(seed); // generates: [rand_0, rand_1, ...] total_profit = 2 * profit(rand()) + 5 * profit(rand()); The race condition can result in two different outcomes given the same seed: total_profit = 2 * profit(rand_0) + 5 * profit(rand_1); total_profit = 2 * profit(rand_1) + 5 * profit(rand_0); Both of those outcomes are valid. Even though there's a reproducibility bug, it doesn't affect the correctness of the model.