I'm trying to program my arduino to play random songs like shuffle on itunes.

I'm having trouble coding this. I have an arduino Uno that plays songs that I have loaded onto a micro sd card. So far I have 4 buttons and each one plays a selected song when the button is pushed. However I want to change the 4th button to play a song at random, and totally at random each time the arduino is powered on, not just repeating the same pattern.

I am using the TMRpcm.play to play the songs.

I understand the random() and randomSeed() functions, and have read several posts on getting buttons to randomly output a name or phrase. I think I can use the analogRead() and randomSeed() together to generate a total random number, but how do I then get the TMRpcm.play to use that random number to pick a song and play it from the micro SD card?

So if I have 10 songs on my micro SD card, for simplicity sake I name them 1.wav to 10.wav I would like to setup something to randomly pick a number between 1 and 10 and then that number corresponds to the song 1.wav to 10.wav and it plays that song.

Does this make any sense?

something like
if (switchState4 == LOW)
tmrpcm.play(random (0,10))

Looks like you've done all your homework, just get out of the paper and experiment in practice :wink:

Random wav file selection