I have a matrix with M rows and N columns. I need to randomly sample different locations in these matrix and return the row indexes and col indexes.
My approach: Say, I want to sample 30 percentage of entries in the matrix. Then, I iterate through the whole matrix, at each point, I toss a biased coin with heads of 30 percent probability and select the location if heads comes. Since, my data is large, this approximately selects 30% of the entries. However, I observe that this is really slow. Is there a way to speed this up? Or a better way to do it?