Adding sample() method.