input: Write a function to generate a random string of a specified length containing alphanumeric characters. The function should take an integer as input representing the length of the string and return the generated string.
  assert generate_random_string(8) == "a1B2c3D4"
  assert generate_random_string(10) == "X9Y8z7W6v5"
  assert generate_random_string(5) == "pQrSt"
  assert generate_random_string(0) == ""
  assert generate_random_string(1) == "?"  # Note: '?' could be any alphanumeric character
output: import random
  import string
  
  def generate_random_string(length):
      return ''.join(random.choices(string.ascii_letters + string.digits, k=length))