As discussed in Ranking Poker Hands:
At maximum you need only swap n-1 items!
Code: (Select All)
TopN = 52
ReDim n(1 To TopN) 'repeatable for ref
For i = 1 To TopN
n(i) = i
Next
For i = TopN To 2 Step -1 ' Fisher Yates Shuffle of N Items
Swap n(i), n(Int(Rnd * (i) + 1))
Next
For i = 1 To TopN
Print " "; i; "-"; n(i); Chr$(9);
Next
Print
At maximum you need only swap n-1 items!
b = b + ...