uniformBlock

fun RectangleGrid.uniformBlock(minWidth: Int = 1, maxWidth: Int = this[0].size, minHeight: Int = 1, maxHeight: Int = this.size, random: Random = Random.Default): RectangleGrid(source)

Extracts a uniform random sub-block of rectangles from a 2D list within the specified constraints.

Return

A 2D list of rectangles representing the randomly extracted uniform block.

Parameters

minWidth

The minimum width (number of columns) of the block. Defaults to 1.

maxWidth

The maximum width (number of columns) of the block. Defaults to the width of the original 2D list.

minHeight

The minimum height (number of rows) of the block. Defaults to 1.

maxHeight

The maximum height (number of rows) of the block. Defaults to the height of the original 2D list.

random

An instance of Random used to generate random coordinates and dimensions for the block.