import ; import ; main(args(2)) := monteCarlo(stringToInt(args[1]), stringToInt(args[2])); chunks := 100; monteCarlo3(n, seed) := let newSeeds := getRandomSequence(seedRandom(seed), chunks).Value; totalHits := monteCarloHelper(n / chunks, seedRandom(newSeeds), 0); in (sum(totalHits) / intToFloat((n / chunks)*chunks))*4.0; monteCarloHelper(n, generator, result) := let xRand := getRandom(generator); x := xRand.Value/(generator.RandomMax + 1.0); yRand := getRandom(xRand.Generator); y := yRand.Value/(generator.RandomMax + 1.0); newResult := result + 1 when x^2 + y^2 < 1.0 else result; in result when n < 0 else monteCarloHelper(n - 1, yRand.Generator, newResult);