n = 0;
for (int y = height - 1; y >= 0; y--)
{
for (int x = 0; x < width; x++)
{
srand(n++);
int index = (x * PIXEL_SIZE) + (y * (width * PIXEL_SIZE)) + (padding * y);
int x2 = rand() % width;
int y2 = rand() % height;
int index2 = (x2 * PIXEL_SIZE) + (y2 * (width * PIXEL_SIZE)) + (padding * y2);
RGBTRIPLE* temp = (RGBTRIPLE*)&image[index];
*(RGBTRIPLE*)&image[index] = *(RGBTRIPLE*)&image[index2];
*(RGBTRIPLE*)&image[index2] = *temp;
}
}
제곧내
못돌려
섞기전에 인덱스 박아넣어야지