Functions for Monte Carlo Methods with R