SeedRnd MilliSecs() Graphics 1024,768 Global cards=LoadAnimImage("gfx\cards.png",52,70,0,52) Local numbersa[53] Local numbersb[53] Local countera=52 Local counterb=52 While countera>0 randoma=Rand(1,52) If numbersa[randoma]=0 Then numbersa[randoma]=countera countera:-1 End If Wend While counterb>0 randomb=Rand(1,52) If numbersb[randomb]=0 Then numbersb[randomb]=counterb counterb:-1 End If Wend Local total[105] For a=1 To 104 If a<=52 Then total[a]=numbersa[a] End If If a>52 Then total[a]=numbersb[a-52] End If Next Local board[14,9] For x=1 To 13 For y=1 To 8 b:+1 board[x,y]=total[b] Print board[x,y] Next Next Repeat Cls For e=1 To 13 For f=1 To 8 DrawImage cards,e*52,f*70,board[e,f] Next Next Flip Until KeyHit(KEY_ESCAPE)
I now get an error on this line (Trying to index array element beyond array length) :
DrawImage cards,e*52,f*70,board[e,f]
As a test, I've printed to debug the values that should be in board[e,f] and I get the expected 104 random values.