Reservoir sampling implementation.

This is going to be used in https://issues.apache.org/jira/browse/SPARK-2568
Please use a deterministic seed passed as an argument.