how do i shuffle arrays?

Pretty sure I have it wrong already, I think i may need the rand function but I'm not sure how the for loop would work. Basically there are 6 pictures and they're in 4 columns, it's a memory game and as of the moment they stay in the same place. I need to make it so that they are random and flipped on the side where you can't see them but I can't figure it out. I have no idea how to randomize columns especially when they're under the name of simply board and NCOLS. Please help me, I appreciate any input

1
2
3
4
5
6
7
8
9
10
  // precondition: board is initialized
// postcondition: board is shuffled by randomly swapping 20 values
void shuffle(int board[][NCOLS]) {
int num = rand();
num = num %6 + 1;
for (int i = 0; i < 20; i++) {


}
}


The full code can be found here as it's a bit long: http://codeviewer.org/view/code:4fea
Topic archived. No new replies allowed.