sum=0; for i=1:N theta=2*rand(); f=e^theta; sum=sum+f; end p=sum/N*2