Author: sebb
Date: Thu Feb  4 16:07:04 2010
New Revision: 906537

URL: http://svn.apache.org/viewvc?rev=906537&view=rev
Log:
Use the super implementation for nextInt(n)

Modified:
    
commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java

Modified: 
commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java?rev=906537&r1=906536&r2=906537&view=diff
==============================================================================
--- 
commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java
 (original)
+++ 
commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/math/JVMRandom.java
 Thu Feb  4 16:07:04 2010
@@ -96,6 +96,7 @@
     public int nextInt() {
         return nextInt(Integer.MAX_VALUE);
     }
+
     /**
      * <p>Returns a pseudorandom, uniformly distributed int value between
      * <code>0</code> (inclusive) and the specified value (exclusive), from
@@ -106,14 +107,9 @@
      * @throws IllegalArgumentException when <code>n &lt;= 0</code>
      */
     public int nextInt(int n) {
-        if (n <= 0) {
-            throw new IllegalArgumentException(
-                "Upper bound for nextInt must be positive"
-            );
-        }
-        // TODO: check this cannot return 'n'
-        return (int)(SHARED_RANDOM.nextDouble() * n);
+        return SHARED_RANDOM.nextInt(n);
     }
+
     /**
      * <p>Returns the next pseudorandom, uniformly distributed long value
      * from the Math.random() sequence.</p>


Reply via email to