tacco.utils.complete_choice

complete_choice(a, size, seed=42)[source]

Similar to numpy.random.choice() with replace=False, but with special behaviour for size>a.shape[0]. The input array is shuffled and concatenated as often as necessary to give size choices. This makes the multiple choices appear as equally as possible.

Parameters:
  • a – A ndarray, or something with a .to_numpy method or behaving reasonably under asarray() with at least one dimension.

  • size – The number of choices without replacement. Can be larger than the a.

  • seed – Random seed or random generator

Returns:

A ndarray containing the choices.