encyclopegia.org

Random permutation

A random permutation is a sequence where any order of its items is equally likely at random, that is, it is a permutation-valued random variable of a set of objects. The use of random permutations is common in games of chance and in randomized algorithms in coding theory, cryptography, and simulation. A good example of a random permutation is the fair shuffling of a standard deck of cards: this is ideally a random permutation of the 52 cards.

A random permutation is a sequence where any order of its items is equally likely at random, that is, it is a permutation-valued random variable of a set of objects. The use of random permutations is common in games of chance and in randomized algorithms in coding theory, cryptography, and simulation. A good example of a random permutation is the fair shuffling of a standard deck of cards: this is ideally a random permutation of the 52 cards. ==Computation of random permutations== ===Entry-by-entry methods=== One algorithm for generating a random permutation of a set of size n uniformly at random, i.e., such that each of the n! permutations is equally likely to appear, is to generate a sequence by uniformly randomly selecting an integer between 1 and n (inclusive), sequentially and without replacement n times, and then to interpret this sequence (x 1 , ..., x n ) as the permutation \begin{pmatrix} 1 & 2 & 3 & \cdots & n \\ x_1 & x_2 & x_3 & \cdots & x_n \\ \end{pmatrix}, shown here in two-line notation. An inefficient brute-force method for sampling without replacement could select from the numbers between 1 and n at every step, retrying the selection whenever the random number picked is a repeat of a number already selected until selecting a number that has not yet been selected. The expected number of retries per step in such cases will scale with the inverse of the fraction of numbers already selected, and the overall number of retries as the sum of those inverses, making this an inefficient approach. Such retries can be avoided using an algorithm where, on each ith step when x 1 , ..., x i − 1 have already been chosen, one chooses a uniformly random number j from between 1 and n − i + 1 (inclusive) and sets x i equal to the jth largest of the numbers that have not yet been selected. This selects uniformly randomly among the remaining numbers at every step without retries. ===Fisher-Yates shuffles=== A simple algorithm to generate a permutation of n items uniformly at random without retries, known as the Fisher–Yates shuffle, is to start with any permutation (for example, the identity permutation), and then go through the positions 0 through n − 2 (we use a convention where the first element has index 0, and the last element has index n − 1), and for each position i swap the element currently there with a randomly chosen element from positions i through n − 1 (the end), inclusive. Any permutation of n elements will be produced by this algorithm with probability exactly 1/n!, thus yielding a uniform distribution of the permutations. unsigned uniform(unsigned m); /* Returns a random integer 0 If the uniform() function is implemented simply as random() % (m) then there will be a bias in the distribution of permutations if the number of return values of random() is not a multiple of m. However, this effect is small if the number of return values of random() is orders of magnitude greater than m. ==Statistics on random permutations== ===Fixed points=== The probability distribution for the number of fixed points of a uniformly distributed random permutation of n elements approaches a Poisson distribution with expected value 1 as n grows. The first n moments of this distribution are exactly those of the Poisson distribution. In particular, the probability that a random permutation has no fixed points (i.e., that the permutation is a derangement) approaches 1/e as n increases. ==References==

References

No reference rows published for this article.

Cite this article

MLA

"Random permutation." encyclopegia.org, 2025, https://encyclopegia.org/wiki/random-permutation. Accessed 24 November 2026.

Chicago

"Random permutation." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/random-permutation.

APA

encyclopegia.org. (2025). Random permutation. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/random-permutation

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Chris Ballance

enwiki · references available

Smit International

enwiki · references available

Fubuki Takane

enwiki · references available

Back, Lewis

enwiki · references available

Claude de Bourdeille, comte de Montrésor

enwiki · references available

Richard Eppes

enwiki · references available

Ted Nichols

enwiki · references available

Yucca schidigera

enwiki · references available

XEG-AM

enwiki · references available

Maine School Administrative District 51

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1284410317 · 0.5 · snapshot enwiki-001284410317

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.