The algorithm is as follows
- Choose the number of Monte Carlo samples \( N \).
- Perform a loop over \( N \) and for each step generate a random number \( x_i \) in the interval \( [0,1] \) through a call to a random number generator.
- Use this number to evaluate \( f(x_i) \).
- Evaluate the contributions to the mean value and the standard deviation for each loop.
- After \( N \) samples calculate the final mean value and the standard deviation.