// put integer array into random order // void shuffle( int a[], int n) { int t, i; while( n > 1) { i = rand() % n; // random position 0 ... n-1 --n; t = a[i]; a[i] = a[n]; a[n] = t; // swap a[i] and a[n] } }