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