title: Choosing random value from weighted options in java
body: <p>When the user clicks, a random output from a set of outputs must be selected. The chances for one value needs to be higher than the other. For example, you click a button and you either receive <code>Bronze</code>, <code>Silver</code>, <code>Gold</code>, or <code>Platinum</code>. Obviously, if you click randomly, you should receive Bronze more than Silver, more than Gold, more than Platinum. For example, could it maybe look like this:</p>
  <pre><code>printRandom(&quot;Bronze&quot;, 30, &quot;Silver&quot;, 20, &quot;Gold&quot;, 10, &quot;Platinum&quot;, 5, &quot;You didn't get anything.&quot;);
  </code></pre>
  <p>Where the final result is when you were unlucky enough to get none. I've been having trouble with making one option more common than the other, not choosing a value in the first place. Thank you.</p>