Randomly selecting loops

I'm wondering if there is a way to randomly select loops in my main loop. For example I have a sketch with various loops in it, each one lights up a LED strip with different patterns and colors. Right now in my main loop, I call these one after the other and they "pllay" in sequence. I'm wondering if there is a way to randomly play the different loops. I was thinking I could assign a number to each loop and then call the random command to play them at random, but can't quite figure out how to do that.

So right now, my main loop looks something like this;

void loop()
{ 
flashing;
blinking;
redplay;
greenplay;
jumping;
kitt;
fading;

Rather than looping in that order every time, I'm wondering if there is a way to randomly play each of those loops.

Any help is always appreciated.

Simple way
Use the random() function to generate a random number
Call a different function depending on the random number using if/else

More complicated way
Create an array of function pointers and use the random number as the index to the array and hence which function is called

By the way,

flashing;

does not call the flashing function

flashing()

calls the flashing() function assuming that it exists in the program

Here is one way using random and switch case

void loop()
{
   byte randNum = random(0, 8);
   switch (randNum)
   {
      case 0:
         flashing();
         break;
      case 1:
         blinking();
         break;
      case 2:
         redplay();
         break;
         // and so on
   }
}

Note that when calling functions the parenthesis are necessary.

Awesome, thank you

Keep in mind that changing the pattern only happens when the current pattern is complete. If you decide that you want to send data via the serial port, and have the Arduino change the pattern being played, when it receives a new value, and a pattern that takes 45 minutes to play out has just started, the Arduino won’t know that you want to change patterns for quite a while.

Writing non-blocking code is almost always better than writing blocking code. And, no more difficult.