This is for a disaster code for generating x and y values. It is on a 512x512 world map. The x and y values cannot fell into both of these ranges at the same time (a box):
501 - 512, 1 -28 for x
232- 256 for y
The code I have
int x = TethysGame::GetRand(512);
int y;
if (x < 28 || x > 501)
{
y = TethysGame::GetRand(232);
}
else
{
y = TethysGame::GetRand(256);
}
I keep getting values within the box that is it not suppose to be in. (6,241) seems to be a common one. It is probably a stupid simple error I do not see but I am tired of looking at it. What is wrong?