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

In some case, we need specify port range used in spark, such as firewall.
Try port = 8949, offset = 0, startPort = 9000, endPort = 9050 for example. You'll get port 8999.

Hm, I think 0 is supposed to mean "`startFunction` decides". In practice it means choose randomly in most (all?) usages. This change would force it to be random. _shrug_ maybe that's a good thing.