So I want to insert random integers to a list. However, I want to make sure that there are no duplicates on the list. Here is what I have done so far:
while (options.size() <=4) {
int i = 0;
int random = ThreadLocalRandom.current().nextInt(answer - 8 ,answer + 8);
if (random != answer && random != options.get(i-1)) {
options.add(random);
i++;
}
}