Parallel Monte Carlo thread unsafe and working