title: Using randi in MATLAB to get random values: values are not distributed uniformly
body: <p>I am generating a random population of strings made of 0s and 1s. I am using <code>randi(2)-1</code> to get a randomly generated single value 0 or 1. I expect to get 1s almost as frequently as 0s. Instead, when I view all the individuals in the population, they mostly consist of 1s. Below is the code - what is wrong?</p>
  
  <pre><code>for iInd=1:individualsCount
      individual(attrCount) = 0;
  
      for i=1:attrCount
           individual(i) = randi(2)-1;
      end
  
      population{iInd} = individual;
  end
  </code></pre>