fixed problems in RandomSample
fixed tests