title: Javascript Get Random result with probability for specific array
body: <p>i have a array and i need to do it randomly show the output by probability below are my code</p>
  
  <pre><code>var shirts = [
                        ["images/fantastic-logo.png","12.65"],
                        ["images/fantastic-word.png","10.00"],
                        ["images/free-product.png","15.50"]
                        ];
  
          var pos = Math.floor((Math.random() * shirts.length) + 0);
          $("#image").html($("&lt;img/&gt;").attr("src", shirts[pos][0]));
          $(".price").html("$" + shirts[pos][1]);
  </code></pre>
  
  <p>i have do the basic math.random() to make it random show the image, now i need to make it show with probability, for example probability for showing ["images/fantastic-logo.png","12.65"] was 50%, ["images/fantastic-word.png","10.00"] was 25%, ["images/free-product.png","15.50"] was 25%.</p>
  
  <p>Thanks for everybody help</p>