Choosing a random integer from a list of ranges in Java
<p>I have a list of ranges in Java</p>

<pre><code>public class Range {
   private int min, max;
   //constructor, getters, setters go here
}
</code></pre>

<p>So, a list may look like this</p>

<pre><code>ranges = [[3,9], [18,45], [90,112]]
</code></pre>

<p>And I need to make the following function</p>

<pre><code>public int getRandomValueWithinRanges() {
   //returns a value which is contained inside a range inside the ranges ArrayList
}
</code></pre>

<p>How can I do this? Each value within those ranges should have an equal probability of being chosen, and it should be done efficiently (i.e. making a list of all the values inside the ranges and then choosing randomly from that list is <em>not</em> efficient)</p>
