RandomUtils { public static String uuid2() { return UUID.randomUUID().toString(); } private  RandomUtils(); static double uniform(double a, double b); static int uniform(int n); static boolean bernoulli(double p); static double gaussian(); static double gaussian(double mean, double stddev); static int discrete(double[] a); static double exp(double lambda); static int[] perm(int n); static void shuffle(String[] a); static LinkedList<Integer> getGaussian(int start, int end, int num, long factor,
                                                  double stdDeviation, double variance, double mean); static double getY(double x, double stdDeviation, double variance, double mean); static long uuid(); static String uuid2();  }
@Test public void testNativeUUID() { int count = 0, len = 100, lost = 0; HashSet<String> set = new HashSet<>(len); int size; long time = 0; long begin, end; String uuid; while (count < len) { size = set.size(); begin = System.nanoTime(); uuid = uuid2(); end = System.nanoTime(); time += (end - begin); set.add(uuid); if (set.size() == size) lost++; count++; } assertEquals(0, lost); _log.info("Count: {}, Time: {} ms", count, time / Math.pow(10, 6)); }