How do i generate random numbers without including one in the domain? Help Please!

jwiz1011jwiz1011 Member Posts: 2
edited January 2012 in Working with GS (Mac)
So I'm making an iPhone game in GameSalad. In the game, the color of the background needs to change randomly to one of four colors every 15 seconds. I did this by creating a new integer attribute and then using a timer to change the attribute to a random number from 1 to 4. Then I told GameSalad to spawn a different color background depending on what number the attribute was (1 for green, 2 for blue, 3 red, 4 yellow). However, I do not want the same background to spawn twice in a row. In order to do this, I would need to make the attribute change to a random number excluding the number that the attribute currently is. Can someone please tell me how to do this.

Thanks alot!

Comments

Sign In or Register to comment.