sample_list()

Randomly sample items from a list.

Usage

Source

sample_list(
    items,
    max_samples=1000,
)

Returns at most max_samples items. If the list has fewer items than max_samples, returns all items in random order.

Parameters

items: list[T]

List of items to sample from.

max_samples: int = 1000
Default is 1000.

Returns

list[T]
List of randomly sampled items.