Java ThreadLocalRandom parseSeed(String seedString)

Here you can find the source of parseSeed(String seedString)

Description

parse Seed

License

Open Source License

Declaration

public static long parseSeed(String seedString) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.ThreadLocalRandom;

public class Main {
    public static long parseSeed(String seedString) {
        if (seedString == null || seedString.length() == 0)
            return ThreadLocalRandom.current().nextLong();
        try {/*from   w  ww . j  a v  a 2s  .co  m*/
            long j = Long.parseLong(seedString);
            if (j == 0L)
                throw new IllegalArgumentException(
                        "Zero (0) isn't a valid seed.");
            return j;
        } catch (NumberFormatException numberformatexception) {
            return seedString.hashCode();
        }
    }
}

Related

  1. getRandomValue(String prefix, long maxValue)
  2. getTempPersistFileName(String baseFileName)
  3. getThreadLocalRandom()
  4. isRandomOccurrence(int pcLikelihood)
  5. moveInRadius(double[] position, double radius)
  6. rand(final Collection items)
  7. randInt(int min, int max)
  8. random()
  9. random()