import math


def computeStartsOfInterval(maxVal: int, intervalLength=1024, min_overlap_part=0.33):
    """
    Divide the [0; maxVal] interval into a uniform distribution with at least min_overlap_part of overlapping
    :param maxVal: end of the base interval
    :param intervalLength: length of the new intervals
    :param min_overlap_part: min overlapping part of intervals, if less, adds intervals with length / 2 offset
    :return: list of starting coordinates for the new intervals
    """
    if maxVal <= intervalLength:
        return [0]
    nbDiv = math.ceil(maxVal / intervalLength)
    # Computing gap to get something that tends to a uniform distribution
    gap = (nbDiv * intervalLength - maxVal) / (nbDiv - 1)
    coordinates = []
    for i in range(nbDiv):
        coordinate = round(i * (intervalLength - gap))
        if i == nbDiv - 1:
            # Should not be useful but acting as a security
            coordinates.append(maxVal - intervalLength)
        else:
            coordinates.append(coordinate)
            # If gap is not enough, we add division with a intervalLength / 2 offset
            if gap < intervalLength * min_overlap_part:
                coordinates.append(coordinate + intervalLength // 2)
    return coordinates