add randomized iterator and sample