From 5ba1f1c695e27d3d97ba713a4eb29bbcaa076da5 Mon Sep 17 00:00:00 2001 From: Phil Steitz Date: Fri, 4 Nov 2011 19:08:47 +0000 Subject: [PATCH] Made use of system identity hashcode explicit in seed computation. JIRA: MATH-701. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1197716 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/math/random/RandomDataImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/math/random/RandomDataImpl.java b/src/main/java/org/apache/commons/math/random/RandomDataImpl.java index def556466..0cd9493c0 100644 --- a/src/main/java/org/apache/commons/math/random/RandomDataImpl.java +++ b/src/main/java/org/apache/commons/math/random/RandomDataImpl.java @@ -828,7 +828,7 @@ public class RandomDataImpl implements RandomData, Serializable { * Returns the RandomGenerator used to generate non-secure random data. *

* 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. *

* * @return the Random used to generate random data @@ -836,7 +836,7 @@ public class RandomDataImpl implements RandomData, Serializable { */ 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 RandomData, Serializable { * Returns the SecureRandom used to generate secure random data. *

* Creates and initializes if null. Uses - * {@code System.currentTimeMillis() + hashCode()} as the default seed. + * {@code System.currentTimeMillis() + System.identityHashCode(this)} as the default seed. *

* * @return the SecureRandom used to generate secure random data @@ -853,7 +853,7 @@ public class RandomDataImpl implements RandomData, Serializable { private SecureRandom getSecRan() { if (secRand == null) { secRand = new SecureRandom(); - secRand.setSeed(System.currentTimeMillis() + hashCode()); + secRand.setSeed(System.currentTimeMillis() + System.identityHashCode(this)); } return secRand; }