Generate 3 correlated Bernoulli random variable

Let $$X_1$$ and $$X_2$$ be two Bernoulli random variables, with $$P(X_1=1)=p_1$$ and $$P(X_2=1)=p_2$$. The following discussion showed how to generate a pair of correlated Bernoulli variables with correlation coefficient $$\rho$$. I want to do the same but for 3 variables $$X_1$$, $$X_2$$, $$X_3$$ with respective probability $$p_1$$, $$p_2$$ and $$p_3$$ and identical correlation coefficient $$\rho$$ between $$X_1$$ and $$X_2$$, $$X_1$$ and $$X_3$$ and $$X_2$$ and $$X_3$$. Intuitively, it seems that this has multiple solutions depending on the higher order association between $$X_1$$, $$X_2$$, $$X_3$$, which I would then fix to 0. Is there a way to generate such distributions of Bernoulli variables (i.e. find the probability of each combination of the three variables)? Can it be generalized to more than 3 variables (assuming null association between more than two variables)?

• The short answer to the question is to seek the keyword copula, which helps in generating $d$ dependent variables with fixed margins. – Xi'an Jan 29 at 14:12