Random Permutations of a Given Length

Generate random permutations on letters that have a "length" within a fixed range. The space of all permutations on letters is stratified by the degree to which a given permutation mixes up the letters. This Demonstration shows how to generate permutations of a given length using essentially Gaussian copula. The parameter determines the degree of disorder, with being total disorder, signifying no disorder, and indicating reversal of order. The red dots are a graph of the points for the given permutation chosen. The gold line is the permutation length scaled by the number of samples. You can change the number of samples or look at many samples with similar permutation lengths by changing the new random case slider. Notice that scrolling through new cases with a given produces almost no variation in permutation length though many different permutations.



  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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 .
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.