Created
January 23, 2013 19:15
-
-
Save itsjoekent/4611767 to your computer and use it in GitHub Desktop.
For Starjik
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list<int> usedNum; | |
main(){ | |
object1.number = getRandom(); | |
object2.number = getRandom(); | |
... etc | |
} | |
int getRandom(){ | |
int number = random.randomInt(4); | |
while(isUsed(number)){ | |
number = new random.randomInt(4); | |
} | |
usedNum.add(number); | |
return number; | |
} | |
boolean isUsed(int number){ | |
return usedNum.contains(number); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment