After reading the Wikipedia page for Monte-Carlo integration, I have understood the basic idea but I am having trouble implementing it for a general case.
The integration that I am trying to do is $$ \int_{-\infty}^{\infty} \frac{\cos x}{x^2}- \frac{\sin x}{x^3} dx $$
This integral is equal to $-\frac{\pi}{2}$, but I do not see how to do it with the Monte-Carlo method. What is the algorithmic procedure in this case?