Exemplo n.º 1
0
 /**
  * Returns the SecureRandom used to generate secure random data.
  *
  * <p>Creates and initializes if null. Uses {@code System.currentTimeMillis() +
  * System.identityHashCode(this)} as the default seed.
  *
  * @return the SecureRandom used to generate secure random data, wrapped in a {@link
  *     RandomGenerator}.
  */
 private RandomGenerator getSecRan() {
   if (secRand == null) {
     secRand = RandomGeneratorFactory.createRandomGenerator(new SecureRandom());
     secRand.setSeed(System.currentTimeMillis() + System.identityHashCode(this));
   }
   return secRand;
 }
Exemplo n.º 2
0
 /**
  * Reseeds the random number generator with {@code System.currentTimeMillis() +
  * System.identityHashCode(this))}.
  */
 public void reSeed() {
   getRandomGenerator().setSeed(System.currentTimeMillis() + System.identityHashCode(this));
 }
Exemplo n.º 3
0
 /**
  * Sets the default generator to a {@link Well19937c} generator seeded with {@code
  * System.currentTimeMillis() + System.identityHashCode(this))}.
  */
 private void initRan() {
   rand = new Well19937c(System.currentTimeMillis() + System.identityHashCode(this));
 }
Exemplo n.º 4
0
 /**
  * Reseeds the secure random number generator with the current time in milliseconds.
  *
  * <p>Will create and initialize if null.
  */
 public void reSeedSecure() {
   getSecRan().setSeed(System.currentTimeMillis());
 }