fixed monte carlo so that it compares y to f(x)