Help with better solution - N number of Random Records per Unique Group

Hi All,
I am working on a robot that needs to create a sample data set from a main dataset.
N number of random records need to be selected from the main dataset per unique group.
The groups are basically concatenation of 6 key columns.

I have created the below solution. Had help with picking the random records part.
But this solution is extremely slow to process.
I am testing it with a dataset of 17000 records and it is taking more than 2 minutes for giving 3 records per group (1190 groups)

But after deployment, the robot will have to handle more than 50000 records and many more groups.

And the other problem I’m facing that the robot is skipping the loop (or thinks it is skipping the loop) and starts executing the next steps. I think the reason may that the loop is so huge.

Below is the code I found on one of the forum topics that helps me get the random records.

dtFilteredTable.AsEnumerable().
		OrderBy(Function(x) Rndm.Next()).
		Take(SampleSize).
		CopyToDataTable()

I am hoping you guys can help me come up with a more efficient way of doing this.