Swap Function for Shuffle Function: Bitmap Image

Hello, I am having trouble finding the correct syntax for this problem: I must randomly shuffle 20 % of the pixels in an image. And I must also, create a swap function to swap the pixels. I have this so far...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 //ZBitmap is the image.
  void red(ZBitmap bitmap){
//This output statement shows the user which case has been chosen, (offscreen).
cout << "Shuffle" << endl;
 
  for (int i = 0; i < .2* bitmap.width * bitmap.height; i++){
//I believe the .2 is the method I can use to make it twenty percent of the
// pixels.
///////////call the swap function here////////////
swap(
  bitmap.pixels[i].R =  0 * bitmap.pixels[i].R ;
  bitmap.pixels[i].G =  0 * bitmap.pixels[i].G ;
  bitmap.pixels[i].B =  0 * bitmap.pixels[i].B ;

 }
}
Topic archived. No new replies allowed.