Divide a number in the way of distributing cards

public static IEnumerable<(int offset, int length)> DivideNumber(int totalNum, int divisor)
{
    var size = totalNum / divisor;
    var remd = totalNum % divisor;
    var offset = 0;
    while (offset < totalNum) {
        var length = size + (remd-- > 0 ? 1 : 0);
        if (length == 0) break;
        yield return (offset, length);
        offset += length;
    }
}

测试1,有5张牌,分给8个人,前五个人每人一张

var r = DivideNumber(5, 8).ToArray();
    offset  length
    ------  ------
    (0,     1)
    (1,     1)
    (2,     1)
    (3,     1)
    (4,     1)

测试2,有33张牌,分给8个人,第一人5张,其余每人4张

var r = DivideNumber(33, 8).ToArray();
    offset  length
    ------  ------
    (0,     5)
    (5,     4)
    (9,     4)
    (13,    4)
    (17,    4)
    (21,    4)
    (25,    4)
    (29,    4)