structure of random_sample.py modified.