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

I was getting some subtle uninitialized member error relating to definition of `dd` used inside of `advance`.  Putting the constructor call to `advance` at the end seemed to fix it.