@Test public void repeat() { Set<String> set = new HashSet<String>(); for (int i = 0; i < 1000; ++i) { String password = MessageLibrary.bytesToString(generator.generate()); assertTrue(set.add(password)); } }
public byte[] generate() { byte[] password = new byte[30]; for (int i = 0; i < password.length; ++i) { int index = random.nextInt(VALID_CHARS.length); password[i] = (byte) VALID_CHARS[index]; } return password; }
PasswordGenerator { public byte[] generate() { byte[] password = new byte[30]; for (int i = 0; i < password.length; ++i) { int index = random.nextInt(VALID_CHARS.length); password[i] = (byte) VALID_CHARS[index]; } return password; } }
PasswordGenerator { public byte[] generate() { byte[] password = new byte[30]; for (int i = 0; i < password.length; ++i) { int index = random.nextInt(VALID_CHARS.length); password[i] = (byte) VALID_CHARS[index]; } return password; }  }
PasswordGenerator { public byte[] generate() { byte[] password = new byte[30]; for (int i = 0; i < password.length; ++i) { int index = random.nextInt(VALID_CHARS.length); password[i] = (byte) VALID_CHARS[index]; } return password; }  byte[] generate(); }
PasswordGenerator { public byte[] generate() { byte[] password = new byte[30]; for (int i = 0; i < password.length; ++i) { int index = random.nextInt(VALID_CHARS.length); password[i] = (byte) VALID_CHARS[index]; } return password; }  byte[] generate();  }