You are on page 1of 1

9/9/2015

DispersionArticlesRandomlyShufflingtheOrderofElementsinanArray

//FisherYatesshuffle
#include<time.h>
#include<stdlib.h>
voidshuffle(int*a,intn)
{
inti=n1;
intj,temp;
srand(time(NULL));
while(i>0)
{
j=rand()%(i+1);
temp=a[i];
a[i]=a[j];
a[j]=temp;
i=i1;
}
}

data:text/htmlcharset=utf8,%3Cpre%20class%3D%22example%20code%20cpp%22%20style%3D%22fontsize%3A%2011px%3B%20margin%3A%201

1/1

You might also like