void Permute(T *a, int n)
{// Random permutation generator.
for (int i = n-1; i > 0; i--) {
   int j = random(i+1); //select an element from a[0] to a[i]
   Swap(a[i], a[j]);
   }
