test function: random_sample