static List<Hue> randomHues(int n){
  List<Hue> resultList=new ArrayList<>(n);
  int huesAvailable=Hue.values().length - 1;
  int maxDistance=huesAvailable / n;
  Random random=new Random();
  int starting=random.nextInt(huesAvailable);
  List<Hue> hues=new ArrayList<>(huesAvailable);
  for (int i=starting; i < huesAvailable; i++) {
    if (Hue.values()[i] != Hue.Neutral) {
      hues.add(Hue.values()[i]);
    }
  }
  for (int i=0; i < starting; i++) {
    if (Hue.values()[i] != Hue.Neutral) {
      hues.add(Hue.values()[i]);
    }
  }
  for (int j=0; j < huesAvailable && resultList.size() < n; j=j + maxDistance) {
    resultList.add(hues.get(j));
  }
  return resultList;
}

static List < Hue > randomHues ( int n ) { List < Hue > resultList = new ArrayList < > ( n ) ; int huesAvailable = Hue . values ( ) . length - 1 ; int maxDistance = huesAvailable / n ; Random random = new Random ( ) ; int starting = random . nextInt ( huesAvailable ) ; List < Hue > hues = new ArrayList < > ( huesAvailable ) ; for ( int i = starting ; i < huesAvailable ; i ++ ) { if ( Hue . values ( ) [ i ] != Hue . Neutral ) { hues . add ( Hue . values ( ) [ i ] ) ; } } for ( int i = 0 ; i < starting ; i ++ ) { if ( Hue . values ( ) [ i ] != Hue . Neutral ) { hues . add ( Hue . values ( ) [ i ] ) ; } } for ( int j = 0 ; j < huesAvailable && resultList . size ( ) < n ; j = j + maxDistance ) { resultList . add ( hues . get ( j ) ) ; } return resultList ; }
returns n hues , chosen to maximize the visual distance between them . we exclude grays from the list
