I am generating random numbers , and someone told me to use srand. I searched about srand and found it is used on top of rand(). But I do not understand why not use just rand() since I get random numbers in my below code:
#include<stdio.h>
#include<stdlib.h>
int main(){
    int i=0;
    for(i=0;i<5;i++){
        printf("random number is %d\n",rand());
    }
}
And I get a set of 5 random numbers. So rand() does gives random numbers. Why do we need srand on top of that then?
 
     
    