You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2011/11/04 20:08:47 UTC
svn commit: r1197716 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
Author: psteitz
Date: Fri Nov 4 19:08:47 2011
New Revision: 1197716
URL: http://svn.apache.org/viewvc?rev=1197716&view=rev
Log:
Made use of system identity hashcode explicit in seed computation. JIRA: MATH-701.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java?rev=1197716&r1=1197715&r2=1197716&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java Fri Nov 4 19:08:47 2011
@@ -828,7 +828,7 @@ public class RandomDataImpl implements R
* Returns the RandomGenerator used to generate non-secure random data.
* <p>
* Creates and initializes a default generator if null. Uses a {@link Well19937c}
- * generator with {@code System.currentTimeMillis() + hashCode()} as the default seed.
+ * generator with {@code System.currentTimeMillis() + System.identityHashCode(this))} as the default seed.
* </p>
*
* @return the Random used to generate random data
@@ -836,7 +836,7 @@ public class RandomDataImpl implements R
*/
private RandomGenerator getRan() {
if (rand == null) {
- rand = new Well19937c(System.currentTimeMillis() + hashCode());
+ rand = new Well19937c(System.currentTimeMillis() + System.identityHashCode(this));
}
return rand;
}
@@ -845,7 +845,7 @@ public class RandomDataImpl implements R
* Returns the SecureRandom used to generate secure random data.
* <p>
* Creates and initializes if null. Uses
- * {@code System.currentTimeMillis() + hashCode()} as the default seed.
+ * {@code System.currentTimeMillis() + System.identityHashCode(this)} as the default seed.
* </p>
*
* @return the SecureRandom used to generate secure random data
@@ -853,7 +853,7 @@ public class RandomDataImpl implements R
private SecureRandom getSecRan() {
if (secRand == null) {
secRand = new SecureRandom();
- secRand.setSeed(System.currentTimeMillis() + hashCode());
+ secRand.setSeed(System.currentTimeMillis() + System.identityHashCode(this));
}
return secRand;
}