Yes. Also, this code snippet is adding the get_samples function to the DataLoader.
In your case, you might not need to instantiate a DataLoader. So, you could use only do the following …
from torchvision.datasets import EMNIST

emnist = EMNIST(root='./emnist_data/', split = 'letters', train=True, transform=None, download=True).data.numpy()

indexes = np.arange(len(emnist))
np.random.shuffle(indexes)

samples = emnist[indexes[:N]]

This ways you get N random samples.