quick question on random #'s

well im not completely sure how this assigns the variable first_die a random number from 1 - 6..

Code:

`const int x = 1;`

const int y = 6;

int main()

{

time_t seconds;

time(&seconds);

srand((unsigned int) seconds);

int first_die = rand() % (y - x + 1) + x;

cout << first_die;

system("PAUSE");

return 0;

}

I understand that x gets a constant value of 1 and y gets a constant value of 6... but why does the higher value get - from the lower value + 1 and all of it + lower value. I dont know... im a bit confused =P

o yea, im not really positive with modulus as well....