1 #include2 using namespace std; 3 4 void swap(int &x, int &y) 5 { 6 x = x^y; 7 y = x^y; 8 x = x^y; 9 }10 11 void rand_n(int array[], int len) 12 {13 int i;14 for (i = 0; i < len; ++i)15 {16 swap(array[i], array[rand() % len]);17 }18 19 for (i = 0; i < len; ++i)20 {21 cout << array[i] << " ";22 }23 cin.get();24 }25 int main(void)26 {27 int table[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};28 rand_n(table, 10);29 30 return 0;31 }