Solution (source code)

= Solution

Interpret the random choice as an independent selector $B$ with $P(B=1)=r$, and write $Y=BX+(1-B)X'$. Its distribution is again uniform on $\{-1,1\}$, so $EX=EY=0$ and $\operatorname{Var}X=\operatorname{Var}Y=1$. By <independence>,
$$
E(XY)=rE(X^2)+(1-r)E(XX')=r.
$$
Consequently \b[$\boxed{\rho(X,Y)=r}$]. The independent selector is the standard meaning of the stated mixture; a choice depending on the signs would describe a different model.