title: Fastest way to generate random boolean vector
body: <p>Given a vector <code>p</code> of probabilities, what is a fast way to generate a random boolean vector <code>x</code> of same length as <code>p</code> and with independent elements such that <code>x[i]==TRUE</code> with probability <code>p[i]</code> for every <code>i</code>?</p>
  
  <p>Specifically, is there a faster way than these?:</p>
  
  <pre><code>p &lt;- rep(0.5,10e6)
  
  system.time(runif(length(p)) &lt; p)
     user  system elapsed 
     0.36    0.02    0.37 
  
  system.time(rbinom(length(p),1,p)&gt;0)
     user  system elapsed 
     1.14    0.04    1.17 
  </code></pre>