Can anyone spot the error in my code? The program will enter the last while loop but continue in an infinite loop... I figured fresh eyes may help spot the flaw!

int xlist[1500], ylist[1500], counter = 0, tempx, tempy, tempcounter;
    bool assign = false;
    while(counter < 1500)
    {
        xlist[counter] = -1;
        counter++;
    }
    counter = 0;
    while(counter < 1500)
    {
        ylist[counter] = -1;
        counter++;
    }
    counter = 0;
    while(counter < 1500)
    {
        tempx = (rand() % 500);
        tempy = (rand() % 500);
        while(tempcounter < counter)
        {
            if(xlist[tempcounter] != tempx || ylist[tempcounter] != tempy)
            {
                assign = true;
                tempcounter++;
            }
            else
            {
                tempcounter = 0;
                assign = false;
                break;
            }
        }
        tempcounter = 0;
        if(assign)
        {
            xlist[counter] = tempx;
            ylist[counter] = tempy;
            counter++;
        }
    }

Haha yeah that was part of it! But for some reason its still not working... I wonder if it can compare correctly with xlist[tempcounter]?

This question has already been answered. Start a new discussion instead.