input: 以下是你要求的问题及其相关代码：
  
  def generate_random_string(length: int) -> str:
      """ Generate a random string of the specified length containing alphanumeric characters.
      >>> generate_random_string(8)
      'a1B2c3D4'  # Example output
      """
output:     import random
      import string
      
      return ''.join(random.choices(string.ascii_letters + string.digits, k=length))