Trying to get random value in specified range? : <p>for one of my assignments I am trying to generate a random number between 16-26 (both inclusive). I've read around and tried different methods but for some reason it goes over the specified range. This is what I have at the moment:</p>

<pre><code>int dealerHand = 16 + (int) (Math.random() * ((26 - 16) + 16));
</code></pre>

<p>Any idea on why this isn't working? Thanks!</p>
