permutations

inline fun <V> permutations(values: List<V>): List<List<V>>(source)

Generates permutations of the given list of values. If the size of the list exceeds a certain limit, it returns a fixed number of randomly shuffled permutations. Otherwise, it calculates all possible permutations.

Return

a list of lists representing the permutations of the input list

Parameters

V

the type of elements in the input list

values

the list of elements for which permutations are to be generated