yokome.util.collections

yokome.util.collections.shuffle(*sequences, random_state=None, n_samples=None)

Consistently shuffle sequences, accessing and yielding elements not before they are needed.

Parameters
  • sequences – Equally long sequences supporting the methods __len__ and __getitem__.

  • random_state – The random state to use for shuffling. May be an int seed for the pseudo-random number generator, a random state instance, or None (in which case numpy.random is used).

  • n_samples – The number of samples to generate. If None, all samples are provided.

Returns

An iterable over sequence elements, in randomly permuted order if only one sequence is provided. Otherwise, an iterable over tuples of sequence elements, one per sequence.