revise the montecarlo function so that it can perform both internal and external parallel computing