You can do this by using dataloader. Pass bs=300 and shuffle=False for your first option. For your second option you can set shuffle=True.
Also, if you do not want to use dataloader. Then you use this.

If you create a pytorch dataset. Then you can access the underlying data using dataset.data[0:300]. In this way you can select your x samples.
To get random samples.

First use torch.randperm(len(dataset)). This will give you a random permutation of integers which you will use as indexes.
Now you can take the samples based on this list.