integral = (maxIter) => {
reload;
const pointsOutside = [];
const pointsInside = [];
const yRange = 4;
for (let i =0; i< maxIter; i++) {
const randPointX = Math.random();
const randPointY = Math.random()*yRange;
if (f(randPointX) >= randPointY) {
pointsInside.push({
x: randPointX,
y:randPointY
})
} else pointsOutside.push({
x: randPointX,
y: randPointY
})
}
return {
integral: pointsInside.length/maxIter*yRange,
pointsInside: pointsInside,
pointsOutside: pointsOutside
}
}