// -- see: http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
void shuffle (int * t, int n)
{
while (--n >= 2)
{
// n is now the last pertinent index
int k = random (n); // 0 <= k <= n - 1
// Swap
int temp = t [n];
t [n] = t [k];
t [k] = temp;
} // end of while
} // end of shuffle
const int NUM = 30; // how many
void setup ()
{
int t [NUM];
// populate table
for (int i = 0; i < NUM; i++)
t [i] = i;
// shuffle it
shuffle (t, NUM);
// print table
Serial.begin (115200);
for (int i = 0; i < NUM; i++)
Serial.println (t [i]);
} // end of setup
void loop () {}