Avoid repeating values
<p>I have a range established and I want to select a set of random numbers from that range (10%) while making sure it does not have repeating values.</p>

<p>How and where do I code this within my program?</p>

<p>Below is an extract.</p>

<pre><code>// Number of Items      
int range = numberOfItems [itemNumber - 1];
// Determine 10 percent of the given range
int tenPercentOfRange = (int)(range * 0.1);
int number = 0;
int[] numbers = new int[tenPercentOfRange];

int index = 0;

for(;index &lt; tenPercentOfRange;)
{
  // Randomly select 10% of the items for a given item.
  number = (int) (range * Math.random()) + 1;
  if(!Arrays.asList(numbers).contains(number))
  {
    numbers[index] = number;
    index++; 
    // ..................
</code></pre>
