Random Int IllegualArgumentException
<p>I am using this code to using a Random generator to generate random positions.</p>

<p>But i keep getting this error </p>

<pre><code>11-06 21:33:07.364: ERROR/AndroidRuntime(12796): java.lang.IllegalArgumentException
11-06 21:33:07.364: ERROR/AndroidRuntime(12796):     at java.util.Random.nextInt(Random.java:186)
</code></pre>

<p>Here is the code i am using.</p>

<pre><code>private void addFace() {
     Random rand = new Random();

        float x = (int) roof.getHeight() + mBallTextureRegion.getWidth();
        float minY = mBallTextureRegion.getHeight();
        float maxY = (int)(roof.getHeight() - mBallTextureRegion.getHeight());
        float rangeY = maxY - minY;
                     //The error points here
        float y = rand.nextInt((int)rangeY) + minY;
</code></pre>
