I have a xml file having 50 different questions and i need only 15 out of them randomly and non-repeated.I used the code below
int n = ((int)(Math.random()*100))%50;
if(temp<15)
{
for(int i=0;i<temp;i++)
{
System.out.println("hello naresh");
if(n==check[i])
{
n=((int)(Math.random()*100))%50;
}
}
check[temp]=n;
}
temp++;
return n;
But by using this some questions are repeated.Please suggest me something which help me to generate the non-repeated questions.