In that case
[EDIT] changed Shuffle() to use type :object, so that it willl shuffle a list full of anything, not just cards.
Type card Field id:Int End Type Function Shuffle:tlist(deck:tlist) Local ShuffledDeck:tlist = New tlist Local o:Object While deck.count() o = deck.ValueAtIndex(Rand(deck.count()-1)) deck.remove(o) ShuffledDeck.AddLast(o) Wend Return ShuffledDeck End Function '--Test Program ' make a deck of cards: Local c:card Local deck:tlist = New tlist For Local n:Int = 1 To 52 c = New card c.id = n deck.addLast(c) Next 'shuffle And list deck = Shuffle(deck) list deck Function List(deck:tlist) For Local c:card = EachIn deck Print c.id Next End Function
[EDIT] changed Shuffle() to use type :object, so that it willl shuffle a list full of anything, not just cards.