mardi 5 octobre 2021

Slot machine using GUI | Generate a random and insert in an array

I'm trying to create a slot machine using GUI. I created three images with respective labels and stored them in an array. I'm trying to print each column (3 columns in total), each row is a random image from that array. However, if the random_int (the random number) I got are duplicate then it's only printing the first of them. For example:

//The array
images[0] = bar (this is the image itself just to visualize not the code)
images [1] = cherry
images [2] = seven

//If the random numbers are: 1 0 0

=> It's only printing: cherry - bar - "blank". Instead of cherry - bar - bar. Can i get some help? Below is the code.

Link to my code: https://replit.com/@ZoeTruong1/unit-1-q6-tester-30#Main.java




Aucun commentaire:

Enregistrer un commentaire