generated two, specific random variables with a correlation I would like to know which is the best method to do the following:
- generate a random variable $Y$ over $Z_2$ (possibly following a Bernoulli distribution) such that $Y$ has correlation $\rho$ with a random variable $X$ following the uniform distribution over $Z_2^k$? 
I.e., If $x \in X$ is uniformed sampled over $Z_2^{k}$, then I want to generate $y \in Y$ over $Z_2$ such that $\mathrm{Corr}(X,Y)$ is a fixed, given $\rho$? 
If possible, I'd like $Y$ to follow a Bernoulli distribution.
As standard, $Z_2=\{0,1\}$ and $Z_2^{k}=\{(x_1,..., x_i,,..., x_k) | x_i \in \{0,1\}\}$.
 A: I will provide solutions to two different interpretations of your question. I don't claim that they are the only or the best solutions.
Every place in which independent Bernoulli is mentioned below, it is to be independent of everything else (all other Bernoullis).
Interpretation A:
$X$ has a Bernoulli distribution having success probability $0.5$.
Solution:
Step 1. Generate $X$ per Bernoulli distribution having success probability $0.5$.
Step 2. 
If $\rho \ge 0$, then for each sample of $X$, set $Y = X$ with probability $\rho$ (i.e., per independent Bernoulli having success probability $\rho$), otherwise set $Y$ = independent Bernoulli having success probability $0.5$. 
If $\rho \lt 0$, then for each sample of $X$, set $Y = 1-X$ with probability $-\rho$ (i.e., per independent Bernoulli having success probability $-\rho$), otherwise set $Y$ = independent Bernoulli having success probability $0.5$. 
Result: $Y$ has a Bernoulli distribution having success probability $0.5$, and $\text{Corr}(X,Y) = \rho$.
Interpretation B: $X$ has a Bernoulli distribution having success probability $b$, and $Y$ must also have a Bernoulli distribution having success probability $b$, with $\text{Corr}(X,Y) = \rho$.
Solution is provided for $\rho \ge 0$ (note that solution for $\rho \lt 0$ and $b =  0.5$ is provided under Interpretation A; otherwise things are problematic).
Step 1. Generate $X$ per Bernoulli distribution having success probability $b$.
Step 2. For each sample of $X$, set $Y = X$ with probability $\rho$ (i.e., per independent Bernoulli having success probability $\rho$), otherwise set $Y$ = Independent Bernoulli having success probability $b$.
Result: $Y$ has a Bernoulli distribution having success probability $b$, and $\text{Corr}(X,Y) = \rho$.
