import random


def set_leave_blank(test_number, required):
    """Sets a generation method's values for whether to leave a field blank.
    :param
        -   test_number:    An int that specifies which submission number this generation is being used for. This will
                            help determine whether the field has been populated previously and whether to leave it blank
        -   required:       A bool specifying whether the field for which input if being generated is required on the
                            form on which the input will be input
    :returns
        -   bool:           Whether the input for the field should be left blank
    """
    leave_blank = False

    # If the field is not required, do logic to determine whether to leave it blank upon fill
    if required is False:
        # Always fill in the field on the first test...
        if test_number != 1:
            # ... but give 25% chance to leave blank otherwise
            leave_blank = True if random.random() < .25 else False

    return leave_blank