added sampling with replacement for mmap input and specified sample size