i am trying to generate random numbers in a loop
i wrote this function
int getRand ( int a , int b )
{
static int x = 0 ;
if ( x == 0 ) {
srand ( time( NULL ) ) ;
x++ ;
}
return a+rand()%(b-a+1);
}
but every time i use it in a loop i get the same number