Question: Pulling data from a cmdb into another repository. Problem is the cmdb data has misspelled/duplicate records (e.g., some assets have a Department Name as Marketing, or Markting, or Marketing&amp -- when they are all just in Marketing). Want to run a select query that displays all incorrectly named department records as the single, correct name. Any help on how to approach this?

Answer: 
You could fill a collection and simply removed a randomly selected number:

```
List<Integer> nums = new ArrayList<>();
for (int i = /* start */; i < /* end */; i++) {
    nums.add(i);
}

//Elsewhere
Random rand = new Random();
int get = nums.remove(rand.nextInt(/* end */);
/* end */--;

```

This may be a bit slower initially for large amounts of numbers but the end result is a lower time-complexity on your checks for new numbers (whereas a while loop could in theory be `O(∞n)` if I'm not mistaken)

Alternatively, use `Collections#shuffle`
```
    ArrayList<Integer> intList = new ArrayList<Integer>();

    int Maximum=10;
    int Minimum=1;
    int r;
    int[] intArray = new int[6];

    for(int i=0; i<intArray.length; i++){

        r = (int)( Minimum+ (Math.random()* (Maximum-Minimum+1)) );

        if(!intList.contains(r)){
            intList.add(r);
            intArray[i]=r;
            System.out.println(r);
        }
        else{
            System.out.println(r+ "is a duplicate generated earlier, not putting in array again");
            i--;
        }

    }

```