Intersects this range with the one passed. This means that the returned rand contains the
maximum of both minima as minimum and the minimum of the two maxima as maximum.

@throws RangeException
if the given range has not intersection with this range
965346
public Range intersect(final Range outerRange) throws RangeException {
		if (min > outerRange.max) {
			throw new IllegalArgumentException("range maximum must be greater or equal than " + min);
		}
		if (max < outerRange.min) {
			throw new IllegalArgumentException("range minimum must be less or equal than " + max);
		}
		int newMin = Math.max(min, outerRange.min);
		int newMax = Math.min(max, outerRange.max);
		return new Range(newMin, newMax);
	}
644038
function rangesIntersect(rangeA, rangeB) {
  return rangeA.compareBoundaryPoints(Range.END_TO_START, rangeB) === -1 &&
    rangeA.compareBoundaryPoints(Range.START_TO_END, rangeB) === 1
}
595506
public static <T extends Comparable<T>> RangeSet<T> intersectRangeSets(final Iterable<RangeSet<T>> rangeSets)
  {
    RangeSet<T> rangeSet = null;
    for (final RangeSet<T> set : rangeSets) {
      if (rangeSet == null) {
        rangeSet = TreeRangeSet.create();
        rangeSet.addAll(set);
      } else {
        rangeSet.removeAll(set.complement());
      }
    }
    return rangeSet;
  }
1208270
public static int random(int min, int max) {
        if (min < 0 || max < 0) {
            throw new RuntimeException(
                    "illegal argment, min and max must great then zero.");
        }
        if (min > max) {
            int t = max;
            max = min;
            min = t;
        } else if (min == max) {
            return min;
        }

        Random random = new Random();
        return random.nextInt(max) % (max - min + 1) + min;

    }
1116350
@Override
  public boolean intersects(IVersionRange yourRange)
  {
    // The set has explicit versions, so just check these against the supplied range
    for (IVersion version : set) {
      if (yourRange.contains(version)) {
        return true;
      }
    }
    return false;
  }
1264997
public Optional<Range<T>> intersect(T t1, T t2) {
        return intersect(new Range<>(t1, t2));
    }
1276593
public static int updateInteger(int value, int range) {
		range = range == 0 ? (int) (0.1 * value) : range;
		int min = value - range;
		int max = value + range;
		return nextInteger(min, max);
	}
441296
public Range intersectionWithTouch(Range other) {
        if (!intersectsWithOrTouches(other))
            return null;

        return new Range(Math.max(lower, other.lower), Math.min(upper, other.upper), reversed && other.reversed);
    }
1144597
function(range) {
			if (this.overlap(range)) {
				var start = Math.max(range.start, this.start);
				var end = Math.min(range.end, this.end);
				return new Range(start, end - start);
			}
			
			return null;
		}
1303702
public RangeLong intersect(RangeLong r) {
		if (min > r.max) return null;
		if (max < r.min) return null;
		return new RangeLong(Math.max(min, r.min), Math.min(max, r.max));
	}
36958
private void checkRangeValues(long minimum, long maximum) {
		if (minimum > maximum) {
			throw EvaluationException.create(
					MSG_MIN_MUST_BE_LESS_OR_EQUAL_TO_MAX, minimum, maximum);
		}
	}
143966
public boolean intersects(double minLon, double maxLon, double minLat, double maxLat) {
        return this.minLon < maxLon && this.minLat < maxLat && minLon < this.maxLon && minLat < this.maxLat;
    }
1364778
public void setFirstOccurence(int min, int max) throws ParseException {
    if (fullCondition == null) {
      if ((min < 0) || (min > max) || (max < 1)) {
        throw new ParseException("Illegal number {" + min + "," + max + "}");
      }
      if (min == 0) {
        firstOptional = true;
      }
      firstMinimumOccurence = Math.max(1, min);
      firstMaximumOccurence = max;
    } else {
      throw new ParseException("fullCondition already generated");
    }
  }
952219
@Override
  public IVersion getMaximum()
  {
    Iterator<IVersionRange> it = ranges.iterator();
    IVersionRange r1 = it.next();
    IVersion max = r1.getMaximum();

    while (it.hasNext()) {
      IVersionRange r2 = it.next();
      IVersion v2 = r2.getMinimum();
      int cmp = max.compareTo(v2);
      if (cmp > 0) {
        return max = v2;
      }
    }

    return max;
  }
555636
public boolean hasIntersection(final Range range) {
		return Math.max(this.start, range.start) <= Math.min(this.end, range.end);
	}
50124
public Range intersection(Range other) {
        if (!intersectsWith(other))
            return null;

        return new Range(Math.max(lower, other.lower), Math.min(upper, other.upper), reversed && other.reversed);
    }
203751
public static Bbox intersection(Bbox one, Bbox two) {
		if (!intersects(one, two)) {
			return null;
		} else {
			double minx = two.getX() > one.getX() ? two.getX() : one.getX();
			double maxx = two.getMaxX() < one.getMaxX() ? two.getMaxX() : one.getMaxX();
			double miny = two.getY() > one.getY() ? two.getY() : one.getY();
			double maxy = two.getMaxY() < one.getMaxY() ? two.getMaxY() : one.getMaxY();
			return new Bbox(minx, miny, (maxx - minx), (maxy - miny));
		}
	}