vendredi 23 octobre 2015

How can I select a random variable from an Array then stop it from being selected again minimally? Android, Java [duplicate]

This question already has an answer here:

I'm creating a 50 states study app (To help me for school), and I want each choice of a state to have it's own random option. So I have an Array holding all of the state's. Is there anyway I can select randomly select a variable from this Array then drop the variable I just used (That way it's not used again). But I want It to take the minimum amount of data, because It will be in my game loop. Which is run 60 times per second (60 FPS). Any Ideas? Here is what I'v thought of:

String.valueOf(stateVariables.get(random.nextInt(3))) //It has four variables in it, so three is the max.

But this doesn't stop the variable it selects from being used again. Please Help!




Aucun commentaire:

Enregistrer un commentaire