Random Functions?

Hey y'all!

So I am creating a C++ project and I am fine tuning the beta. I have 10 different functions that run in a row, but I would like to make them run in a random order each time I run the program.
I had the idea of doing this with a random number generator and a switch/case statement but I am not sure how to do this...
All help
you should create a random number generator and then give each of you case:'s in the switch statement a number. make sure the number generator only generates from 1 to 10 then make your generator feed a number into the switch.
I suppose I forgot to mention, however, that I need them all to run ONLY once...
as in all one after the other??
u can use the srand() function to generate a random number from 1 to 10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <algorithm>  // random_shuffle()
#include <cstdlib>    // srand() and rand()
#include <ctime>      // time()
#include <iostream>
using namespace std;

void function_zero()
  {
  ...
  }

...

int main()
  {
  int sequence[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  srand( (unsigned) time( NULL ) );
  random_shuffle( sequence, sequence + 10 );
  for (unsigned n = 0; n < 10; n++)
    switch (sequence[ n ])
      {
      case 0: function_zero(); break;
      case 1: function_one();  break;
      ...
      }
  return 0;
  }

Hope this helps.
Topic archived. No new replies allowed.