I know similar question have been asked before but bear with me.
I have an array:
int [] arr = {1,2,3,4,5,6,7,8,9};
I want numbers to be generated randomly 10 times. Something like this: 4,6,8,2,4,9,3,8,7 (Although some numbers are repeated, no number is generated more than once in a row).
But not like this: 7,3,1,8,8,2,4,9,5,6 (As you can see, the number 8 was repeated immediately after it was generated. This is not the desired effect).
So basically, I'm ok with a number being repeated as long as it doesn't appear more than once in a row.
Aucun commentaire:
Enregistrer un commentaire