@Test public void shouldCreateRandomString() { final String randA = Utilities.createRandomAlphanumeric(10); final String randB = Utilities.createRandomAlphanumeric(10); assertThat(randA, not(containsString(randB))); }
public static String createRandomAlphanumeric(final int length) { final Random r = ThreadLocalRandom.current(); final char[] randomChars = new char[length]; for (int i = 0; i < length; ++i) { randomChars[i] = ALPHANUMERICS[r.nextInt(ALPHANUMERICS.length)]; } return new String(randomChars); }
Utilities { public static String createRandomAlphanumeric(final int length) { final Random r = ThreadLocalRandom.current(); final char[] randomChars = new char[length]; for (int i = 0; i < length; ++i) { randomChars[i] = ALPHANUMERICS[r.nextInt(ALPHANUMERICS.length)]; } return new String(randomChars); } }
Utilities { public static String createRandomAlphanumeric(final int length) { final Random r = ThreadLocalRandom.current(); final char[] randomChars = new char[length]; for (int i = 0; i < length; ++i) { randomChars[i] = ALPHANUMERICS[r.nextInt(ALPHANUMERICS.length)]; } return new String(randomChars); } private  Utilities(); }
Utilities { public static String createRandomAlphanumeric(final int length) { final Random r = ThreadLocalRandom.current(); final char[] randomChars = new char[length]; for (int i = 0; i < length; ++i) { randomChars[i] = ALPHANUMERICS[r.nextInt(ALPHANUMERICS.length)]; } return new String(randomChars); } private  Utilities(); static boolean isNullOrEmptyString(final String value); static String createRandomAlphanumeric(final int length); static String createAlphanumericHash(final String str, final int length); static void generateInvocationIdIfNecessary(final TraceeBackend backend); static void generateSessionIdIfNecessary(final TraceeBackend backend, final String sessionId); }
Utilities { public static String createRandomAlphanumeric(final int length) { final Random r = ThreadLocalRandom.current(); final char[] randomChars = new char[length]; for (int i = 0; i < length; ++i) { randomChars[i] = ALPHANUMERICS[r.nextInt(ALPHANUMERICS.length)]; } return new String(randomChars); } private  Utilities(); static boolean isNullOrEmptyString(final String value); static String createRandomAlphanumeric(final int length); static String createAlphanumericHash(final String str, final int length); static void generateInvocationIdIfNecessary(final TraceeBackend backend); static void generateSessionIdIfNecessary(final TraceeBackend backend, final String sessionId); static final Charset CHARSET_UTF8; }