#include <stdio.h>
#include <time.h>
#include <stdlib.h>// 洗牌算法
void shuffle(int v[], int n){
int i,temp,j;
for(i=0;i<n;++i){
j=rand()%(i+1);
temp=v[i];
v[i]=v[j];
v[j]=temp;
}
}int main(void){
int n,v[20],i;
srand(time(NULL));
n=10;
for(i=0;i<n;++i){ v[i]=i;}
for(i=0;i<n;++i){ printf("%d ",v[i]);}
shuffle(v,n);
puts("");
for(i=0;i<n;++i){ printf("%d ",v[i]);}return 0;
}
09-08
1243
08-03
250