title: How to get distribution of sum of dependent bernoulli variables
body: <p>I have N bernoulli variables, <code>X1</code>, ..., <code>XN</code>, and <code>Xi~B(1, pi)</code>, <code>pi</code> is known for each <code>Xi</code>, and <code>Y=X1+...XN</code>, now I need to get the destribution of <code>Y</code>.</p>
  
  <p>If <code>Xi</code> and <code>Xj</code> is independent when <code>i!=j</code>, then I can use the simulation:</p>
  
  <pre><code>1. Generate `X1`, ..., `XN` via their distribution, and then get the value of `Y`;
  2. Repet step 1 for 10000 times, and then I can get `Y1`, ..., `Y10000`, so I can konw the distribution of `Y`.
  </code></pre>
  
  <p>But now <code>Xi</code> and <code>Xj</code> is dependent, so I also need to take into account the correlation, assuming that <code>corr(Xi, Xj)=0.2</code> when <code>i!=j</code>, how can I insert the correlation to the simulation? Or get the distribution of Y via other ways?</p>
  
  <p>Thanks for the help and advise.</p>