Random Generator for MP3 player

Okay first off I'm a nut for Halloween and this is a project for a decoration. I have found a great many prop controller on line and some using a UNO.
One controller has ambient sound playing until the PIR is triggered and then there is a Scare sound file that plays.
I'm wondering if I get a servo to animated a Skeleton mouth, can the sketch code have a line that randomly selects a file between a set of number? Say file 1 to file 20, and each file would be just called a number so that way the audio file could be changed without having to change the code.

Thanks in advance!

Tim

Yes, sure.

this initializes a YX-5300 module and plays one of the 15 files in folder 0 at random upon startup:

  delay(500);//Wait until chip initialization is complete
  sendCommand(CMD_SEL_DEV, DEV_TF);                     //select the YX5300 TF card 
  //delay(200);//wait for 200ms
  sendCommand(CMD_SET_VOLUME, 0x06001e);
  randomSeed(analogRead(A0));      
  sendCommand(CMD_PLAY_W_INDEX, 0X030000 +random(1,15));// play on reset 1 of 15 files in root folder

it uses this function:

void sendCommand(uint8_t command, int16_t dat)
{
  Send_buf[0] = 0x7e;    //starting byte
  Send_buf[1] = 0xff;    //version
  Send_buf[2] = 0x06   ; //the number of bytes of the command without starting byte and ending byte
  Send_buf[3] = command; //
  Send_buf[4] = 0x00;    //0x00 = no feedback, 0x01 = feedback
  Send_buf[5] = (int8_t)(dat >> 8);//data high byte
  Send_buf[6] = (int8_t)(dat); //data low byte
  Send_buf[7] = 0xef; //ending byte
  
  for(uint8_t i=0; i<8; i++)//
  {
   Serial2.write(Send_buf[i]);
   lcd4.setCursor(6,3); lcd4.print("  "); lcd4.setCursor(6,3); lcd4.print(dat >> 8, HEX);
   lcd4.setCursor(8,3); lcd4.print("  "); lcd4.setCursor(8,3); lcd4.print(dat & 15, HEX);
  }
}

it requires this on top, below the libraries:

//  YX-5300
#define CMD_SEL_DEV 0X09
#define DEV_TF 0X02
#define CMD_SET_VOLUME 0X06
#define CMD_PLAY_W_INDEX 0X03

static unsigned int Send_buf[8] = {0};  // char string for YX-5300 commands

you can use up to 256 folders, 256 files per folder, with this module

Please see this thread. It should have exactly what you're looking for, minus the servo control

Isn't it easier to just use the DF Player Mini library for this?

One way to get randoms is to use low order bits from millis().

The millis() function returns ms since startup as a 32 bit value but if you assign it to a byte then the low 8 bits is what you get.

byte rando;

......

rando = millis(); // pseudo-random 0-255

If you want 0 to 15 then

rando = rando & 15; // 15 is binary 00001111