Fix use of random.sample