Added new functions to generate random sample batches for training.