Hello everyone I've been trying to create a game for a couple of weeks however I'm unable to create a function that randomly plays a new function all the time without replaying the same function it just played before.
I've been using the following script to generate a random function to play.
func playgame(){
var randomgen = arc4random % 6
switch(randomgen){
case 0:
game1()
break
case 1:
game2()
break
case 2:
game3()
break
case 3:
game4()
break
case 4:
game5()
break
case 5:
game6()
break
default:
break
}
When the player presses a button the function runs again generating a random game function.
How can I generate a random game without generating the same game that has been generated befor.
For example: if game1() was generated and I press the next game button I want to generate a random game from the other 5 games available. The idea is to be able to play the six game indefinitely.