Return Set with random unique Integer numbers between min and max range
Generating unique random numbers within a range

A good way to generate unique random numbers within a range is to create a list with the desired unique numbers, and then shuffle it.

  private Set&lt;Integer&gt; getRandomUniqueNumberSet(int min, int max) {
    List&lt;Integer&gt; numbers = IntStream.rangeClosed(min, max).boxed().collect(Collectors.toList());
    Collections.shuffle(numbers);
    return new LinkedHashSet&lt;&gt;(numbers);
  }


Don't used boxed types when you don't need null values

This method takes Integer parameters, which may be null:


private Set&lt;Integer&gt; getRandomUniqueNumberSet(Integer min, Integer max)



But the implementation doesn't handle the case when these values are null.
And it doesn't make sense to support such ranges.
Change those types to primitive int.

The same goes for the local variables Integer index and Boolean loop.

Why ThreadLocalRandom?

As per the javadoc, "use of ThreadLocalRandom is particularly appropriate when multiple tasks use random numbers in parallel in thread pools". I doubt that's necessary in your use case, in which case I suggest to use an instance of Random instead.