pyrit.common.get_random_indices

pyrit.common.get_random_indices#

get_random_indices(*, start: int, size: int, proportion: float) List[int][source]#

Generate a list of random indices based on the specified proportion of a given size. The indices are selected from the range [start, start + size).

Parameters:
  • start (int) – Starting index (inclusive). It’s the first index that could possibly be selected.

  • size (int) – Size of the collection to select from. This is the total number of indices available. For example, if start is 0 and size is 10, the available indices are [0, 1, 2, …, 9].

  • proportion (float) – The proportion of indices to select from the total size. Must be between 0 and 1. For example, if proportion is 0.5 and size is 10, 5 randomly selected indices will be returned.

Returns:

A list of randomly selected indices based on the specified proportion.

Return type:

List[int]