[SPARK-3250] Implement Gap Sampling optimization for random sampling

More efficient sampling, based on Gap Sampling optimization:
http://erikerlandson.github.io/blog/2014/09/11/faster-random-samples-with-gap-sampling/

It doesn't affect the output, so I didn't spend the code/computation on clamping it.   The only reason I put in the checks at all was because I felt like it might catch logic errors in calling code.  For example, if somebody sampled with fraction '-1.0', it could cheerfully return an empty data set, but that would more likely be an error somewhere.  But -0.0001 is more likely to be just rounding jitter.