if you care about the name of the animation, you could keep it with the array (and the size of the array) in a structure. Then you make an array of structure and pick randomly an entry in that array
here is an example (typed here, not tested) that would print a random animation every 3s (Serial Monitor @ 115200 bauds)
byte Left2Right[] = {2, 3, 4, 5, 6, 7, 8, 9};
byte Right2Left[] = {9, 8, 7, 6, 5, 4, 3, 2};
byte LeftOut2In1[] = {2, 9, 3, 8, 4, 7, 5, 6};
byte RightOut2In[] = {9, 2, 8, 3, 7, 4, 6, 5};
byte In2Out1[] = {5, 6, 4, 7, 3, 8, 2, 9};
byte In2Out2[] = {6, 5, 7, 4, 8, 3, 9, 2};
struct t_animation {
const char* name;
byte length;
byte* list;
};
t_animation animationList[] = {
{"Left2Right ", sizeof Left2Right, Left2Right},
{"Right2Left ", sizeof Right2Left, Right2Left},
{"LeftOut2In1", sizeof LeftOut2In1, LeftOut2In1},
{"RightOut2In", sizeof RightOut2In, RightOut2In},
{"In2Out1 ", sizeof In2Out1, In2Out1},
{"In2Out2 ", sizeof In2Out2, In2Out2},
};
const byte animationCount = sizeof animationList / sizeof animationList[0];
void playAnimation(byte index) {
Serial.print(F("Playing animation: ")); Serial.print(animationList[index].name);
Serial.print(F("\t"));
for (byte i = 0; i < animationList[index].length; i++) {
Serial.print(animationList[index].list[i]); Serial.write(' ');
}
Serial.println();
}
void setup() {
Serial.begin(115200); Serial.println();
}
void loop() {
byte randomAnimationIndex = random(0, animationCount); // pick one of the animations
playAnimation(randomAnimationIndex);
delay(3000);
}