Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Deal a deck of cards


Dim Cards(52), i As Integer , j As Integer , temp As Integer
'shuffle the deck
For i = 1 To 52
   'randomly pick a swap position    
   j = Int (52)
   'swap the current position And the random position
  temp = Cards(i)
  Cards(i) = Cards(j)
  Cards(j) = temp
Next i
'cards() Now contains random selection of cards positions - 1 thru 52