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

The following style is commonly used in Spark:
 
~~~
      new PartitionwiseSampledRDD[T, T](
        this, new BernoulliPartitionSampler[T](x(0), x(1)), true, seed)
~~~