FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
January 01, 2000

Algorithm Alley

(Page 3 of 9)
Jan00: Algorithm Alley


for (Dest = N-1; Dest > 0; Dest--)
{
   Src = rand() % (Dest+1);  // Positions from [0] to [Dest]
   Swap (X[Src], X[Dest]);
}

Example 2: C++ implementation of shuffling algorithm that does generate all permutations with equal probability.

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK