import string
import random


def random_password(size):
    """Generate a random password of length 'size'
    
    The resulting password may contain any of:
        upper or lowercase letters A-Z
        the digits 0-9
        valid punctuation marks defined in the 'punctuation' variable below
    """
    punctuation = '#$%&!'
    chars = string.ascii_letters + string.digits + punctuation
    return ''.join(random.choice(chars) for _ in range(size))