Monte Carlo code