title: Quick way of selecting a random item from a list - with varying probabilities based on item value?
body: <p>(This may not be possible short of writing a decently sized helper method, but regardless, I'd like to figure it out)</p>
  
  <p>Say I have a list:</p>
  
  <pre><code>{1,3,6}
  </code></pre>
  
  <p>I'd like to get a random item from that list, BUT, I'd like it to be weighted directly (probability-wise) with the item's value. So if you ran it 100,000 times, the <code>1</code> would be selected about 10,000 times, the <code>3</code> would be selected about 30,000 times, and the <code>6</code>, 60,000 times.</p>
  
  <p>I may just write a helper method by creating ranges like this:</p>
  
  <pre><code>{1,3,6}
  
  Generate random number between 1(inclusive) and 11(exclusive) (sum of list)
  
  if (number == 0)
  {
      //1
  }
  else if (number &gt; 0 &amp;&amp; number &lt; 4)
  {
      //3
  }
  else
  {
      //6
  }
  </code></pre>
  
  <p>Though that particular example is fairly simple, I'm often working with large lists and they are always different, so it'd be a bit more complex. While I could do it, I'm curious whether there's an easier way.</p>