Skip to content

Instantly share code, notes, and snippets.

@itsjoekent
Created January 23, 2013 19:15
Show Gist options
  • Save itsjoekent/4611767 to your computer and use it in GitHub Desktop.
Save itsjoekent/4611767 to your computer and use it in GitHub Desktop.
For Starjik
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