I'm trying to generate a random number between 0 and 9

i've used the following different methods

(int)((double)rand() / ((double)RAND_MAX + 1) * N) rand() / (RAND_MAX / N + 1) rand() % N /* POOR */

i use N = 10 to get 0 - 9 random numbers..

well i'm not getting random numbers i'm always getting the same number..

any ideas?