input: Write a python function to generate a random password of a given length using a specified set of characters.
  assert len(generate_password(8, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')) == 8
  assert all(c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' for c in generate_password(12, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'))
  assert len(generate_password(15, 'abc123')) == 15
output: import random
  
  def generate_password(length, characters):
      return ''.join(random.choice(characters) for _ in range(length))