Added reservoir sampling in the dataio module and the corresponding unit tests