title: JavaScript random generate 0 or 1 integer
body: <p>I am trying to generate random 0 or 1 as I am writing a script to populdate my database. If it is 1, I will save it as male and 0 the other way around.</p>
  
  <p>Inside my JavaScript:</p>
  
  <pre><code>Math.floor((Math.random() * 1) + 1);
  </code></pre>
  
  <p>I used this to generate either 1 or 0. However, with the code above, it always return me with 1. Any ideas?</p>