import string
import random


def generate_password(length: int) -> str:
    """Return random password of specified length."""
    choice = string.ascii_letters + string.digits
    password = ""

    for character in random.choices(choice, k=length):
        password += character
    return password