// function to shuffle an array of integers
void shuffle(int[] a)
{
int temp, pick;
for(int i=0; i<a.length; i++)
temp = a[i];
pick = (int)random(a.length);
a[i] = a[pick];
a[pick] = temp;
}