[SPARK-4449][Core] Specify port range in spark

In some case, we need specify port range used in spark, such as firewall.
"This doesn't work if port isn't in the range, right? that seems like a problem" , Hi, @srowen, you mean in `else` branch here?  if ```port``` is not in the range, then ```((port + offset - startPort) % (endPort - startPort)) + startPort``` will give us a port in this range