#include<stdio.h> #include<stdlib.h> #include<math.h> #include<time.h> int main() { int a[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; int n=16; int i,j,T=1000,tmp; srand(unsigned(time(NULL))); while(T--) { i=rand()%n; j=rand()%n; tmp=a[i]; a[i]=a[j]; a[j]=tmp; } for(i=0;i<n;i++) printf("%d ",a[i]); puts(""); return 0; }
本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/1429940