I am working on an quiz app. I managed to randomized the questions(from an array) with
int position = new Random().nextInt(questions.length);
but the questions keep on repeating. How do i make it stop getting when it reaches lets say 10 questions without repeating? Here is my code if it helps:
gcfQuiz.setText(questions[position]);
    gcfButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            EditText Answer = (EditText) findViewById(R.id.txtAns1);
            String finAns = Answer.getText().toString();
            if (finAns==answers[position]){
                correct++;
            }
            position++;
            if (position<questions.length)
            {
                gcfQuiz.setText(questions[position]);
            }else {
                Intent in = new Intent(getApplicationContext(), gcfResult.class);
                startActivity(in);
            }
        }
    });
 
     
     
     
     
    