srand

Hello there, i have an problem with my code, i use an random generated number from 1 to 19 with this code (see under) but what is the problem here, it will generate same number after some ones, for example: first is 13, second is 15, third is 8, forth is 2, fifth is 13 and the upcoming number are same as the upcoming of first, it is a problem with my code or with this function? Thanks in advance.

1
2
srand(time(0));
yp=rand()%19 + 1;
You should only call srand once at the beginning of the program.
Oh, im soo stupid :P

Thank you man!
Topic archived. No new replies allowed.