diff --git a/solitaire.lua b/solitaire.lua index 47ba2b2..734f694 100644 --- a/solitaire.lua +++ b/solitaire.lua @@ -70,7 +70,8 @@ end function shuffle(cards) for a,c in ipairs(cards) do - local b=math.random(#cards) + if a == #cards then break end + local b=a + math.random(#cards - a) local tmp=cards[a] cards[a]=cards[b] cards[b]=tmp @@ -122,6 +123,7 @@ function BOOT() end function TIC() + math.random(52) if btnp(6) then reset() end if game_state=='MENU' then update_menu();