title: JavaScript: How To Code a Heads/Tails With Specific Probability Chance Percentage?
body: <p>I've implemented the function:</p>
  
  <pre><code> function coinFlip() {
        return(Math.floor(Math.random()*2) === 0) ? 'Heads' : 'Tails';
   }
  </code></pre>
  
  <p>And it's all working fine (I already tested it).</p>
  
  <p>My problem is, how do I make this function so that the probability of getting 'Heads' is 30% while the probability of getting 'Tails' is 70%?</p>
  
  <p>Thanks in advance</p>