Monte Carlo PI generator in JavaScript