private int randomSelector(int max, double randValue) { double low = 0; double high;  for (int i = 1; i < max + 1; i++) { high = (double)i / max;  if ((randValue >= low) && (randValue < high)) { return i; }  low = high; }  return 1;
private int randomSelector(int max) { return ((int) (Math.random() * max)) + 1;
    private int randomSelector(int max, double randValue) {        double low = 0;        double high;        for (int i = 1; i < max + 1; i++) {            high = (double)i / max;            if ((randValue >= low) && (randValue < high)) {                return i;            }            low = high;        }        return 1;    }