monte carlo method implemented