Randomizing Pictures

Hey. I was wondering if anyone knows how to choose a random picture from a file of pictures. The program I am working on is BINGO, and I am trying to do it with images. The only way I can think of choosing a random picture
is if I have 15 IF statements per square on the board (24 squares, free space in the middle obviously doesn't need
to be random. This will add up to 360 IF statements). Can anyone think of any other way, possibly more efficient than doing this?

Thanks in advance.

By the way, I am using SDL.

~Cadence
Last edited on
Hint: For Loop
Okay. That makes sense, except for the location of the picture.

For instance:
 
if (b[1]==1) one = load_image( "1.bmp" );

How could I change the "1.bmp" to an x or whatever the For Loop is using?
I tried using sort of the same thing before, and it didn't work.
I tried this:
 
one = load_image( b[1]".bmp" );

But that didn't work.
Last edited on
Okay. Never mind. I figured out how to do it.

I had like 81 individual pictures before, and now I put them all into one picture (sprite sheet) and I just made the coordinates for each pic. Now I can randomize it using the for loop like you said.
Topic archived. No new replies allowed.