Replace or not

In the above code, we have use replacement in setting up the mini-batches. The discussion here may be useful.