import random
import string


def random_password(minlength=20, maxlength=30):
    """
    Generate random string used as password.
    """
    length = random.randint(minlength, maxlength)
    letters = string.ascii_letters + string.digits
    return ''.join([random.choice(letters) for _ in range(length)])