make_shuffler

utilipy.data_utils.make_shuffler(length: int, rng=None) → Tuple[Sequence[int], Sequence[int]][source]

Shuffle and Unshuffle arrays.

Parameters
lengthint

Array length for which to construct (un)shuffle arrays.

rngGenerator instance, optional

random number generator.

Returns
shufflerndarray

index array that shuffles any array of size length along a specified axis

undondarray

index array that undoes above, if applied identically.