Created
June 14, 2014 14:57
-
-
Save zsrinivas/ea9a9d8f1b0cddf43ec9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void swap(int *p,int *q) | |
{ | |
int temp; | |
temp=*p; | |
*p=*q; | |
*q=temp; | |
} | |
void shuffle(int *data,int size) | |
{ | |
int i,j; | |
srand(time(NULL)); | |
for (i = 0; i < size-1; ++i) | |
{ | |
j=rand()%(size-i) + i; | |
swap(data+i,data+j); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment