generate random number in java within a range without repeating with android studio

Solutions on MaxInterview for generate random number in java within a range without repeating with android studio by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "generate random number in java within a range without repeating with android studio"
Karl
28 May 2016
1 public void NextRandom(View view) // button clicked function
2    {
3        int previousIndex = index;
4        index = rand.nextInt(array.size());
5
6        while (index == previousIndex)
7        {
8            index = rand.nextInt(array.size());
9        }
10    }