Permutation length for a permutation

on the set

is defined as the cardinality of the set of all

such that

if

. The greater the permutation length, the more disordered the permutation. The question is how to generate random permutations of similar lengths. We accomplish this using samples from a bivariate normal with correlation

and then sorting the resultant pairs by their first element and measure of disorder. The resulting pairs give the permutation

. The maximal permutation, ranked by length, is the permutation that takes

to

. This has a length of

and is the longest permutation possible. The height of the gold line in the graph is the permutation length of the given displayed permutation divided by the length of the maximal permutation multiplied by the number of samples. That is, if

is permutation length and

is the maximal permutation, then the height of the gold bar is

.