If you XOR a random input with a biased input, the output is random - why? Ive seen in an answer to this question here :

https://stackoverflow.com/questions/5889238/why-is-xor-the-default-way-to-combine-hashes/5889288#5889288

that If you XOR a random input with a biased input, the output is random .

What is the reason for that ?
Is there a formal proof ?

thx
Let $X, Y \in \{0,1\}$ be random variables, with $\Pr[X = 0] = \Pr[X = 1] = 1/2$ and any distribution on $Y$ as long as $Y$ is independent of $X$ so that $$\Pr[Y = y \mathrel| X = x] = \Pr[Y = y]$$ for any fixed bits $x, y \in \{0,1\}$.  What is the distribution on $X \oplus Y$?  Let $b \in \{0,1\}$ be a fixed bit.  Then

\begin{align*}
  \Pr[X \oplus Y = b]
    &amp;= \Pr[X \oplus Y = b \mathrel| X = 0]\cdot\Pr[X = 0] \\
      &amp;\quad\quad + \Pr[X \oplus Y = b \mathrel| X = 1]\cdot\Pr[X = 1] \\
    &amp;= \Pr[0 \oplus Y = b \mathrel| X = 0]\cdot(1/2) \\
      &amp;\quad\quad + \Pr[1 \oplus Y = b \mathrel| X = 1]\cdot(1/2) \\
    &amp;= \Pr[Y = b \mathrel| X = 0]\cdot(1/2) \\
      &amp;\quad\quad + \Pr[Y = b \oplus 1 \mathrel| X = 1]\cdot(1/2) \\
    &amp;= \Pr[Y = b]\cdot(1/2) + \Pr[Y = b \oplus 1]\cdot(1/2) \\
    &amp;= (\Pr[Y = b] + \Pr[Y = b \oplus 1])\cdot(1/2) \\
    &amp;= 1/2,
\end{align*}

the last equality arising because $b$ and $b \oplus 1$ are the only two possible values that $Y$ can take on, so $\Pr[Y = b] + \Pr[Y = b \oplus 1] = 1$.