import string
import random


def random_string(n):
    """
        Generates a random string.
    """
    random_str = ""
    for x in range(n):
        rand = string.ascii_letters + string.digits
        random_str += random.choice(rand)

    return random_str