[SPARK-2082] stratified sampling in PairRDDFunctions that guarantees exact sample size

Implemented stratified sampling that guarantees exact sample size using ScaRSR with two passes over the RDD for sampling without replacement and three passes for sampling with replacement.
You can make it simpler by using count:
```scala
(0 until x2).count(i => random.nextUniform(0.0, 1.0) < thresholdByKey.get(t._1).get)
```