Skip to content

Instantly share code, notes, and snippets.

@metrafonic
Last active August 29, 2015 14:08
Show Gist options
  • Save metrafonic/25a27f7c9ba651e4f904 to your computer and use it in GitHub Desktop.
Save metrafonic/25a27f7c9ba651e4f904 to your computer and use it in GitHub Desktop.
Deal function for a c poker application, will place card values in the array hand parameter.
void deal(int hand[]){
int deck[52]= { 0 };
int i, verdi;
for (i=0;i<5;i++){
verdi = rand() % 52;
while(deck[verdi]==1){
verdi = rand() % 52;
}
hand[i]=verdi;
deck[verdi]=1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment