If I interpret your question correctly, the answer is that the exponential random variable $\xi$ (density $e^{-x}$) has the property that for two independent copies $\xi_1,\xi_2$ of $\xi$, one has $P(a\xi_1\le b\xi_2)=\int_{y_1\le ry_2}e^{-y_1-y_2}dy_1dy_2=\frac r{1+r}$ with $r=\frac ba$, which is exactly what you wanted (in the first paragraph, at least; the second paragraph problem is completely different from the first paragraph one; I hope you realize that). To convert the uniform variable into the exponential, just take the natural logarithm.
fedja
- 61.9k
- 11
- 160
- 302