©
Shuffling
  Shuffles the sequence of the integers 1..n.
2024.Nov.25 03:23:19
n Size of sequence. •
Show values Shows the computed sequence. •

Computes a random ("shuffled") permutation of the sequence of the integers from 1 to n. Gives some simple functions of the sequence obtained: positions of 1 and n, verification of the minimum (1) and the maximum (n) in the sequence, and its sum [which must be n(n + 1) / 2].

The procedure constitutes the extraction of a sample without replacement.

The computation follows Algorithm 3.4.2P from Knuth [1981, p 139].

References: Plate: WithoutReplacement

Knuth, Donald E., 1981, "The art of computer programming", vol. 2 (Seminumerical algorithms), 2.nd ed., Addison-Wesley, Chichester (UK), xiv+688 pp (ISBN 978-0-470-01427-1).

• 1903-12-28: von Neumann, John (1957-02-08).

 
 
Valid HTML 4.01! IST http://web.ist.utl.pt/~mcasquilho/compute/com/Fx-shuffle.php
Created: 2011-12-28 — Last modified: 2011-12-28