[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 parentheses are not necessary and add `()` to `next`:

~~~
    data.getClass match {
      case `arrayClass` =>
        (n: Int) => data = data.drop(n)
      case `arrayBufferClass` =>
        (n: Int) => data = data.drop(n)
      case _ =>
        (n: Int) => {
          var j = 0
          while (j < n  &&  data.hasNext) {
            data.next()
            j += 1
          }
        }
    }
~~~