One way would be to see the distribution of the sequence

Assuming , rand() is implemented really well (highly unlikely) well and generates uniformly on the set of integers {0,1,2,..........,RAND_MAX-1}

then

rand()%N, will generate a random variable with the following distributuion ,

it will take values 0,1,2,...,N-1 with the probability

([(RAND_MAX-1)/N]+1)/RAND_MAX,([(RAND_MAX-2)/N]+1)/RAND_MAX,............., [(RAND_MAX-N)/N]+1)/RAND_MAX

If N is very small compared to RAND_MAX all are close to 1/N

o.w there can be a problem

if your N is say (RAND_MAX-1)/2 then

the probability of

rand()%N being 0 is 3/RAND_MAX rather than 1/N (=2/(RAND_MAX-1) ) which means it will appear approx 1.5 times more than it should .