@Test public void testCommonsLang3RandomStringUtilsHomog() { final String set = "abc"; final char[] chars = set.toCharArray(); String gen; final int[] counts = {0,0,0}; final int[] expected = {200,200,200}; for (int i = 0; i< 100; i++) { gen = CommonsLang3RandomStringUtils.random(6,chars); for (int j = 0; j < 6; j++) { switch (gen.charAt(j)) { case 'a': {counts[0]++; break;} case 'b': {counts[1]++; break;} case 'c': {counts[2]++; break;} default: {fail("generated character not in set");} } } } assertTrue(chiSquare(expected,counts) < 13.82, "test homogeneity -- will fail about 1 in 1000 times"); }
public static String random(final int count) { return random(count, false, false); }
CommonsLang3RandomStringUtils { public static String random(final int count) { return random(count, false, false); } }
CommonsLang3RandomStringUtils { public static String random(final int count) { return random(count, false, false); } CommonsLang3RandomStringUtils(); }
CommonsLang3RandomStringUtils { public static String random(final int count) { return random(count, false, false); } CommonsLang3RandomStringUtils(); static String random(final int count); static String randomAscii(final int count); static String randomAlphabetic(final int count); static String randomAlphanumeric(final int count); static String randomNumeric(final int count); static String random(final int count, final boolean letters, final boolean numbers); static String random(final int count, final int start, final int end, final boolean letters, final boolean numbers); static String random(final int count, final int start, final int end, final boolean letters, final boolean numbers, final char... chars); static String random(int count, int start, int end, final boolean letters, final boolean numbers,
                                final char[] chars, final Random random); static String random(final int count, final String chars); static String random(final int count, final char... chars); }
CommonsLang3RandomStringUtils { public static String random(final int count) { return random(count, false, false); } CommonsLang3RandomStringUtils(); static String random(final int count); static String randomAscii(final int count); static String randomAlphabetic(final int count); static String randomAlphanumeric(final int count); static String randomNumeric(final int count); static String random(final int count, final boolean letters, final boolean numbers); static String random(final int count, final int start, final int end, final boolean letters, final boolean numbers); static String random(final int count, final int start, final int end, final boolean letters, final boolean numbers, final char... chars); static String random(int count, int start, int end, final boolean letters, final boolean numbers,
                                final char[] chars, final Random random); static String random(final int count, final String chars); static String random(final int count, final char... chars);  }