[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/

In this context `epsilon` is to do with preventing `log(0)` problems in the computations, and isn't really a constraint on sampling fraction `f`  So, it's OK for `f` to be smaller than `epsilon`, long as it's > 0