code: public static String generatePassword(int length)
    {
      Params.strictPositive(length, "Password length");
      StringBuilder password = new StringBuilder(length);
      Random random = new Random();
  
      for(int i = 0; i < length; i++) {
        String charCategory = PASSWORD_DICTIONARY[random.nextInt(PASSWORD_DICTIONARY.length)];
        int position = random.nextInt(charCategory.length());
        password.append(charCategory.charAt(position));
      }
      return new String(password);
    }
docs: Generate random password of requested length. Generated password contains characters from
  {@link #PASSWORD_DICTIONARY} and has exactly requested length.
  
  @param length password length, strict positive.
  @return random password of requested length.