def constant(delay, limit):
    """Constant delay generator.

    :param delay:
        The delay in milliseconds.
    :param limit:
        The number of delays to yield.
    :type delay: int or float
    :type limit: int
    :return:
        A generator function which yields a sequence of delays.
    :rtype: function
    """
    def func():
        if delay < 0:
            raise ValueError('delay must be non-negative')

        if limit < 0:
            raise ValueError('limit must be non-negative')

        for _ in range(limit):
            yield delay

    return func