title: Uniform distribution of binary values in Matlab
body: <p>I have a requirement for the generation of a given number N of vectors of given size each consistent of a uniform distribution of 0s and 1s.</p>
  <p>This is what I am doing at the moment, but I noticed that the distribution is strongly peaked at half 1s and half 0s, which is no good for what I am doing:</p>
  <pre><code>a = randint(1, sizeOfVector, [0 1]);
  </code></pre>
  <p>The <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/stats/unifrnd.html" rel="nofollow noreferrer"><code>unifrnd</code> function</a> looks promising for what I need, but I can't manage to understand how to output a binary vector of that size.</p>
  <p>Is it the case that I can use the <code>unifrnd</code> function (and if so how would be appreciated!) or can is there any other more convenient way to obtain such a set of vectors?</p>
  <p>Any help appreciated!</p>
  <p><strong>Note 1</strong>: just to be sure - here's what the requirement actually says:</p>
  <blockquote>
  <p>randomly choose N vectors of given size that are
  uniformly distributed over [0;1]</p>
  </blockquote>
  <p><strong>Note 2</strong>: I am generating initial configurations for Cellular Automata, that's why I can have only binary values [0;1].</p>