global rIndex, CCindexes, MaxCard, Cnt, Opt, DigO, Trumps
if ((Cnt = 2) and (Opt = 2)) or Trumps then
set Modulo to 22
else
if (Cnt = 2) or DigO then
set Modulo to 78
else
set Modulo to 156
end if
end if
set Cnt to the controlDown
set Opt to the optionDown
set rIndex to (random(Modulo) + the lastClick) mod Modulo
repeat while (CCindexes contains string(rIndex)) or (CCindexes contains string(rIndex mod 78)) or (CCindexes contains string(rIndex + 78)) or ((rIndex mod 78) = 0) or (rIndex = 0)
set rIndex to (random(Modulo) + the lastClick) mod Modulo