input: from typing import List
  
  def generate_random_password(length: int, use_special_chars: bool) -> str:
      """ Generate a random password of given length, which consists of alphanumeric characters.
      If use_special_chars is True, the password must include at least one special character.
      >>> generate_random_password(8, True)
      'aB3!dF7#'
      >>> generate_random_password(6, False)
      '1a2B3c'
      """
output:     import random
      import string
  
      characters = string.ascii_letters + string.digits
      if use_special_chars:
          characters += string.punctuation
  
      password = ''.join(random.choice(characters) for _ in range(length))
  
      if use_special_chars:
          while not any(char in string.punctuation for char in password):
              password = ''.join(random.choice(characters) for _ in range(length))
  
      return password