commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/math JVMRandom.java
Date Mon, 12 May 2003 04:29:27 GMT
bayard      2003/05/11 21:29:26

  Modified:    lang/src/java/org/apache/commons/lang/math JVMRandom.java
  Log:
  Fixed bug reported by Phil Steitz in which poorly placed casting was
  making all random methods return 0 :)
  
  Revision  Changes    Path
  1.3       +3 -3      jakarta-commons/lang/src/java/org/apache/commons/lang/math/JVMRandom.java
  
  Index: JVMRandom.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/math/JVMRandom.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JVMRandom.java	7 May 2003 19:14:01 -0000	1.2
  +++ JVMRandom.java	12 May 2003 04:29:26 -0000	1.3
  @@ -103,7 +103,7 @@
        */
       public int nextInt(int n) {
           // check this cannot return 'n'
  -        return (int)Math.random() * n;
  +        return (int)(Math.random() * n);
       }
       /**
        * Returns the next pseudorandom, uniformly distributed long value 
  @@ -113,7 +113,7 @@
        */
       public long nextLong() {
           // possible loss of precision?
  -        return (long)Math.random() * Long.MAX_VALUE;
  +        return (long)(Math.random() * Long.MAX_VALUE);
       }
       /**
        * Returns the next pseudorandom, uniformly distributed boolean value 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message