mcframework.core.make_blocks#

mcframework.core.make_blocks(n: int, block_size: int = 10000) list[tuple[int, int]][source]#

Partition an integer range \([0, n)\) into half-open blocks \((i, j)\).

Parameters:
nint

Total number of items.

block_sizeint, default: 10_000

Target block length.

Returns:
list of tuple[int, int]

List of (i, j) index pairs covering [0, n).

Examples

>>> make_blocks(5, block_size=2)
[(0, 2), (2, 4), (4, 5)]