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`
if you just want to exclude a single number replace this:

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

```

with this:

```
while( ( r = (int)(Math.random() * Maximum) + Minimum) == excludedNumber );

```