50% Random , Got a problem

I need to do a random function, It should randomly do any of the two function, That means, It randomly chooses between the function which one to be executed hope you understand
The C standard library provides two functions that provide random numbers. Here's an example of how they're used http://www.cplusplus.com/forum/beginner/43680/
You need this if I understand:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<stdlib.h>
#include<time.h>

void random_1(){
//...something
}
void random_2(){
//...something
}

void main(){
// seed for rand(), determined by system's clock
srand(time(NULL));
// rand()%2 means random number between 0 and 1 (rand()%100 -> 0-99 )
if( rand()%2 < 1 ) random_1();
else random_2();
}
Topic archived. No new replies allowed.