How would we randomize the order of execution of a set of functions. A random fuction with the starting variable the time of day i.e. minutes.
How would we randomize the order of execution of a set of functions. A random fuction with the starting variable the time of day i.e. minutes.
> How would we randomize the order of execution of a set of
> functions. A random fuction with the starting variable the time
> of day i.e. minutes.
Explain what you mean. Are you trying to generate a random number? Are you trying to execute a series of function calls who's order is random? What exactly. You need to give us more parameters for whatever it is you're trying to do.
Quzah.Code:#include <stdio.h> #include <time.h> void myfun1( void ); void myfun2( void ); void myfun3( void ); void myfun4( void ); void myfun5( void ); int main ( void ) { srand( time( 0 ) ); switch( rand()%5 ) { case 0: myfun1( ); break; case 1: myfun2( ); break; case 2: myfun3( ); break; case 3: myfun4( ); break; case 4: myfun5( ); break; } return 0; }
Hope is the first step on the road to disappointment.
We are trying to execute a series of function calls whose order is random and whose randomness changes at every program execution