I have done this, but it's pretty ugly and it feels like I may be missing something to shorten it:    vector<int> xcomb, ycomb;    int limitW = Pdriver->getViewPort().getWidth() / 32;    int limitH = Pdriver->getViewPort().getHeight() / 32;    int width = Pdriver->getViewPort().getWidth();    int height = Pdriver->getViewPort().getHeight();    while (true){    start:        ax = -rand() % width+32;        ax = (ceil((double)ax / 32) * 32);        ay = -rand() % height + 32;        ay = (ceil((double)ay / 32) * 32);        int temp = 0;        if (xcomb.size() == 0)            xcomb.push_back(ax);        for (int i = 0; i < xcomb.size(); i++)        {            if (ax != xcomb[i])                temp++;        }        if (temp == xcomb.size())            xcomb.push_back(ax);        temp = 0;        if (ycomb.size() == 0)            ycomb.push_back(ay);        for (int i = 0; i < ycomb.size(); i++)        {            if (ay != ycomb[i])                temp++;        }        if (temp == ycomb.size())            ycomb.push_back(ay);        if (ycomb.size() == limitH && xcomb.size() == limitW)        {            char na[20];            sprintf_s(na, GAME COMPLETE!);            OutputDebugString(na);        }        for (u16 i = 0; i < TailCollision.size(); i++)            if (TailCollision[i] == core::rect<s32>(32 - ax, 32 - ay, 64 - ax, 64 - ay)){            OutputDebugString(\nAPPLE TAIL CRASH PREVENTED!\n);            goto start;            }        if (core::rect<s32>(32 - ax, 32 - ay, 64 - ax, 64 - ay) != Block(x, y)){            break;        }    }    xcomb.clear();    ycomb.clear();}If you excuse the mess, you can see that I want a number that is divisible by 32.I use this to make a Max combination number (limitW and limitH).I then use two vectors and add all random values that hasn't been tried before during this process (while loop).And to do that I think I may be doing it in a bit of a workaround. I use a temporary int which I increment for each comparison, and if it has compared the same amount as the size of the vector, it means that number already exists and it has to redo the calculation.It may be that this is the only option, but it just seems that I do too many steps.
Calculating all combinations to make sure a Random algorithm has done them all
c++;random;collision;coordinate system