simplify the implementation of RandIntSampler