The idea behind this method is to generate many random points which can be outside or below the function we want to integrate. Is important to keep track of how many points are generated below the graph. Then, one creates any shape in which the graph is fully contained in the domain of integration. The most common shape used is a rectangle, this is because later we will need to compute the area of this region. From the relation
the definite integral can be obtained.
In this example I used the gaussian function
Generating
Comparing this value with the given by the graph calculator from Geogebra (