Importance Sampling
Here is the code that perform the importance sampling on f(x):
importance_sample.c