We have changed the integration limits in the second integral, since we have performed a change of variables. Since we have used the uniform distribution defined for \( x\in [0,1] \), the integration limits change to \( 0 \) and \( 1 \). The variable \( y \) is now a function of \( x \). Note also that in practical implementations, our random number generators for the uniform distribution never return exactly 0 or 1, but we may come very close.
The algorithm for the last example is rather simple. In the function which sets up the integral, we simply need to call one of the random number generators like \( ran0 \), \( ran1 \), \( ran2 \) or \( ran3 \) in order to obtain numbers in the interval [0,1]. We obtain \( y \) by the taking the logarithm of \( (1-x) \). Our calling function which sets up the new random variable \( y \) may then include statements like
.....
idum=-1;
x=ran0(&idum);
y=-log(1.-x);
.....