package jetbrains.buildServer.serverSide; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Random; public class RandomGenerator { private Random myRandom = createRandom(); public Random getRandom() { return myRandom; } private static Random createRandom() { Random random = new Random(); try { //This could take up to 30 seconds! random = SecureRandom.getInstance("SHA1PRNG"); } catch (NoSuchAlgorithmException e) { // } finally { random.setSeed(System.nanoTime()); } return random; } }