Indeed, that's one reason this code is shit -- the way they re-order one of their internal lists during execution is non-deterministic (ie probably skull fucked by the os thread scheduling). Nevertheless, assuming an acceptably-random value is generated whenever your rand() function is called, it's worth pointing out that the whole point of a Monte Carlo simulation is to show that a model converges on an answer or a pattern of answers, regardless of what random values are used from pass to pass. In this case, the failure to maintain determinism is more of a bug than it is an inherent design flaw, and ultimately has no bearing on the accuracy of the answer.
Indeed, that's one reason this code is shit -- the way they re-order one of their internal lists during execution is non-deterministic (ie probably skull fucked by the os thread scheduling). Nevertheless, assuming an acceptably-random value is generated whenever your rand() function is called, it's worth pointing out that the whole point of a Monte Carlo simulation is to show that a model converges on an answer or a pattern of answers, regardless of what random values are used from pass to pass. In this case, the failure to maintain determinism is more of a bug than it is an inherent design flaw, and ultimately has no bearing on the accuracy of the answer.