global seed .
func xrnd .
   seed = (seed * 214013 + 2531011) mod 0x80000000
   return seed div 0x10000
.
len cards[] 52
proc deal game_num . .
   print "hand " & game_num
   seed = game_num
   for i = 1 to 52
      cards[i] = 52 - i
   .
   for i = 1 to 51
      j = 52 - xrnd mod (53 - i)
      swap cards[i] cards[j]
   .
.
suits$[] = strchars "CDHS"
ranks$[] = strchars "A23456789TJQK"
# 
proc show . .
   for idx = 1 to 52
      rank = cards[idx] div 4 + 1
      suit = cards[idx] mod 4 + 1
      write ranks$[rank] & suits$[suit] & " "
      if idx mod1 13 = 13
         print ""
      .
   .
   print ""
.
deal 1 ; show
deal 617 ; show
