Zufälliges Mischen

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

*Folgender Algorithmus von R. A. Fisher und F. Yates (1938) findet sich im Band 2 des Werks ``The Art of Computer Programming'' von D. Knuth:
 
*Algorithm P (Shuffling). Let X1, X2, ···, Xt be a set of t numbers to be shuffled.

*[Initialize.] Set j <- t.
 
*[Generate U.] Generate a random number U, uniformely distributed between zero and one.
 
*[Exchange.] Set k <- ⌊ jU ⌋ + 1. (Now k is a random integer, between 1 and j). Exchange Xk <-> Xj.
 
*[Decrease j.] Decrease j by 1. If j > 1, return to step P2.
 

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 2004, 2005 Andreas Borchert, in HTML konvertiert am 18.02.2005