yep its beautiful how this can be done, its basically just taking the mean of values of function derived from random values from a uniform distribution of points in a specific range. Once done many times, we can approximate the integration value. Because E[X] = integration (f(u)p(u)du), p(u) will be 1 as the number is derived from a uniform distribution in the range of u.