int[] array = {1, 2, 3};
int badIndex = 1;
int variable;
int i;
Random random = new Random();
do {
i = random.nextInt(array.length);
}while (i == badIndex);
variable = i;
int[] validIndexes = {0,1,2,5,6,7,9,10};
int random = random.nextInt(validIndexes.length);
int validIndex = randomIndexes[random];