Skip to content

Commit

Permalink
Fixed bug in shuffle algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Aug 26, 2011
1 parent 3a2a1ab commit cb80c2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/commas.lua
Expand Up @@ -152,7 +152,7 @@ shuffle (cards)
function shuffle(t)
local n = #t
while n > 2 do
while n >= 2 do
-- n is now the last pertinent index
local k = math.random(n) -- 1 <= k <= n
-- Quick swap
Expand Down

0 comments on commit cb80c2b

Please sign in to comment.