Question: I have a problem where I have sum of two random variables 

1). Each distributed independently normally with different means ($\mu\_1$, $\mu\_2$) and sds ($\sigma\_1$, $\sigma\_2$). $Z=R\_1+R\_2$

2). Each distributed independently log-normally with different means ($u\_1$, $u\_2$) and sds ($s\_1$, $s\_2$). $LZ=LR\_1+LR\_2$

In the first case, the answer lies in (-$\infty$, $\infty$) and (0, $\infty$) in the second case. 

I need to transform these random variables i.e. $Z$ and $LZ$ to make them probabilities and lie in [0, 1], as I want to simulate a Bernoulli Trial with that probability.

I see that as a case of remapping probability densities.

For case 1, I think I could use the logistic transform on $Z$ to make it a probability which lies in [0, 1]. I hope that makes sense?

Also, I am clueless regarding how to do this mapping for the case of lognormal distribution?

I would really appreciate any feedback on this!

Answer: 
If it's just a matter of doing the simulation, you can, in the normal case, do:

```
mu1 <- 0
mu2 <- 1

sd1 <- 1
sd2 <- 3

N <- 10^4

z <- rnorm(N, mean = mu1, sd = sd1) + rnorm(N, mean = mu2, sd = sd2)

x <- rbinom(N, size = 1, prob = exp(z)/(exp(z)+1))

```

For the lognormal:

```
u <- exp(z)

y <- rbinom(N, size = 1, prob = u/(u+1))

```

By the way, the title of the question is misleading. You're just changing the range of the random variables, you're not transforming them in a uniform random variable.
Let $X$ have the continuous cdf $F\_X(x)$ then define the random variable $Y=F\_X(x)$. Then $Y$ is uniformly distributed on $(0,1)$. This important property is called the Probability Integral Transform.

In your case, you may transform $Z$ and $LZ$ to uniformly distributed variables by using their respective cdf's. The first cdf is easy (Z is normally distributed), the last is more challenging (the sum of two log normals is not log normal). 

Proof:
$$P(Y\leq y) = P(F\_X(X) \leq y)$$
$$=P(F\_X^{-1}[F\_X(X)] \leq F\_X^{-1}(y))$$
$$=P(X \leq F\_X^{-1}(y))$$
$$=F\_X(F\_X^{-1}(y))=y$$

At the end points we have $P(Y \leq y)=1$ for $y = 1$ and $P(Y \leq y)=0$ for $y = 0$ verifying that $Y$ has a uniform distribution.