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
This commit is contained in:
Phil Steitz 2011-11-04 19:08:47 +00:00
parent e0385f30bf
commit 5ba1f1c695
1 changed files with 4 additions and 4 deletions

View File

@ -828,7 +828,7 @@ public class RandomDataImpl implements RandomData, Serializable {
* Returns the RandomGenerator used to generate non-secure random data. * Returns the RandomGenerator used to generate non-secure random data.
* <p> * <p>
* Creates and initializes a default generator if null. Uses a {@link Well19937c} * 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> * </p>
* *
* @return the Random used to generate random data * @return the Random used to generate random data
@ -836,7 +836,7 @@ public class RandomDataImpl implements RandomData, Serializable {
*/ */
private RandomGenerator getRan() { private RandomGenerator getRan() {
if (rand == null) { if (rand == null) {
rand = new Well19937c(System.currentTimeMillis() + hashCode()); rand = new Well19937c(System.currentTimeMillis() + System.identityHashCode(this));
} }
return rand; return rand;
} }
@ -845,7 +845,7 @@ public class RandomDataImpl implements RandomData, Serializable {
* Returns the SecureRandom used to generate secure random data. * Returns the SecureRandom used to generate secure random data.
* <p> * <p>
* Creates and initializes if null. Uses * 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> * </p>
* *
* @return the SecureRandom used to generate secure random data * @return the SecureRandom used to generate secure random data
@ -853,7 +853,7 @@ public class RandomDataImpl implements RandomData, Serializable {
private SecureRandom getSecRan() { private SecureRandom getSecRan() {
if (secRand == null) { if (secRand == null) {
secRand = new SecureRandom(); secRand = new SecureRandom();
secRand.setSeed(System.currentTimeMillis() + hashCode()); secRand.setSeed(System.currentTimeMillis() + System.identityHashCode(this));
} }
return secRand; return secRand;
} }