Random Numbers

(rand()&4)+1;

Why is that sometimes producing a 5? I thought that could only produce 1-4..
It should be (rand() % 4) + 1. (Note the %)
oops, I knew that too...Thanks.
Topic archived. No new replies allowed.