private void setTargetPosition() { int x = RandomUtil.GetInt(TARGET_AREA_SIZE - 1); int y = RandomUtil.GetInt(TARGET_AREA_SIZE - 1); bool isUpper = RandomUtil.GetBool(); bool isLeft = RandomUtil.GetBool(); int verticalAreaStart = isUpper ? 0 : SIZE - TARGET_AREA_SIZE; int horizontalAreaStart = isLeft ? 0 : SIZE - TARGET_AREA_SIZE; TargetPosition = new Point(verticalAreaStart + x, horizontalAreaStart + y); }