Ok, first we start with a simple transformation, log(x) -> x , making the integral
I = S 2/(1+x^2) dx, x in [0...infinity]
where S is the sign of integration.
Thus, the function 1 / (1 + x ^ 2) decreases monotonously and reasonably quickly. We need some reasonable PDF to select points in the interval [0 ... infinity], so that most of the area in which the original function is significant is covered. We will use an exponential distribution with some free parameter, which we will use to optimize the selection.
I = S 2/(1+x^2)*exp(k*x)/kk*exp(-k*x) dx, x in [0...infinity]
So, we have k * e -kx as a properly normalized PDF in the range [0 ... infinity]. The function for integration is (2/(1+x^2))*exp(k*x)/k . We know that the selection from the exponent is mainly -log(U(0,1)) , so the code for this is very simple
k <- 0.05
The result is 3.145954 , for the result of seed 22345 is 3.135632 , for the result of seed 32345 is 3.146081 .
UPDATE
Returning to the original function [0 ... 1] is quite simple
UPDATE II
changed to prof.Bolker offer
source share