How to make a int not be used twice when it randomly generates them? I've coded a simple quiz game for Android, and currently Im having troubles with making questions not appear after they've been shown, i.o. I dont want it to ask me the same question twice..

This is the method Im using

 private void QBegin() {
   /*
    * Gets a random question
    */
    question = (TextView) findViewById(R.id.question);
    String[] types = { "Question one",
            "Question two", 
            "Question three", 
            "Question four",
            "Question five"};
    Random random = new Random();
    int qType = random.nextInt(types.length);
    question.setText(types[qType]);
    getAnswers(qType); //gets four answers
}


Im not sure if this will work but, what if I add something like

Edit : Doesn't work..

    int i = 0;
    ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
    list.add(qType);
    i++;
    if(list.contains(qType) &amp;&amp; i != types.length + 1){
        return;
    } else {
        answerCounter.setText("Hit the bricks pal, you're done..");
    }


On http://stackoverflow.com got told to , add smth like:

    ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
    list.add(types.length);
    Collections.shuffle(list);
    if(!list.contains(qType)){
        // help please, as I have no idea on what I should be doing!
    }
There are basically two different ways of doing this efficiently:


Put the questions in a list
Shuffle the list
Loop through the list and show the questions


or:


Put the questions in a list
Pick a question to show by random
Remove that question from the list
Repeat until the list is empty