How to generate random numbers in c

How to generate random numbers in c
C code to generate random numbers 

int main(){
    int num;

    //initialize the random number generator

    //Generating the random number
    num = random(99999);

    //Printing the random number
    return 0;

Note: random function random(val) generates any number between 1 to num -1 . randomize() function is used only to initialize the random number generator. It internally call the used the header file time.h

1 comment:

Anonymous said...

:11:5: error: too many arguments to function ‘random’
num = random(99999);

/usr/include/stdlib.h:321:17: note: declared here
extern long int random (void) __THROW;