How to shuffle imageIcons in an array? : <p>I am trying to code a memory matching game - the standard type of concentration game where the player is shown picture cards, they're flipped over, and they have to match the corresponding cards.</p>

<p>There's a few things that have me completely at a loss as to where I should even begin, and I would really appreciate it if I could get some advice. I'm not sure how I would shuffle the images in an array of Buttons each time I restarted the game. I considered making an integer matrix and shuffling the numbers and images separately, but 1) I'm not sure how to shuffle ImageIcons on a button, and 2) the 2 numbers that are supposed to match up would have different images.</p>

<p>I also considered making a String array to shuffle the filenames of the ImageIcons, but I think that would require reassigning each individual image icon (there are 48 cards and 24 pairs so that would take up a lot of time). Could I get some ideas on how to approach this problem? Is there an easier/more efficient solution than the ones I've thought up? I know there's a Fisher-Yates shuffle algorithm used for cards but I can't quite understand it. </p>
