I use this function to generate random integer.
int rnd(int min, int max)
{
    static int srand(time(0));
    return min + rand() % max;
}
Is it right? May be better to move srand(time(0)); to the main function? Like this:
int rnd(int min, int max){
    return min + rand() % max;
}
int main(){
srand(time(0));
..............
}
 
     
     
     
    