combinatorics: Functions for combinatorics

Functions for combinatorics (combinations with repetitions, derangements, etc.)

Functions

all_combinations(seq[, size])

combinations_with_repetition(seq, size)

Yield all combinations of the elements of seq :rtype: Generator[Tuple[TypeVar(T), ...], None, None]

derangements(seq)

compute permutations of seq where each element is not in its original position

distance_from_sorted(seq[, offset])

Distance between seq and a sorted seq.

permutation_further_than(xs, min_distance[, ...])

Return a permutation of xs with a min.

random_distance(length[, numseqs])

Calculate the distance between a sorted seq.

random_range(length)

Return an array of of ints from 0 to length-1, in random order

unsort(seq, entropy[, margin, tolerance, ...])

Generate a permutation of xs unsorted according to the given entropy.

unsort2(xs[, entropy, margin, error, numiter])

unsortedness(seq)

The entropy of the ordering in this seq.