import random


def generate_hex_colour(ex_prop: float = 10.0) -> str:
    """ Generates a random hex color sampled from a partitioned color space

    Args:
        ex_prop (float): Head & tail-end proportions to exclude from sampling.
            This is to make sure that the generated colours are of a certain
            distance away from white or black. Specified as a percentage.
    Returns:
        Random hex color (str)
    """
    MIN_COLOUR_VALUE = 0
    MAX_COLOUR_VALUE = 16777215
    
    final_min_value = int(MIN_COLOUR_VALUE + (ex_prop / 100 * MAX_COLOUR_VALUE))
    final_max_value = int(MAX_COLOUR_VALUE - (ex_prop / 100 * MAX_COLOUR_VALUE))
    random_number = random.randint(
        a=final_min_value,
        b=final_max_value
    )
    hex_number = str(hex(random_number))
    hex_number ='#'+ hex_number[2:]
    return hex_number