I would like to sample rows from a three dimensional array without replacement. For example, if I have

x = rand(10, 5, 3)

a random set of indices might look like {(2,2), (9,3)}, where the first position is the index of the first dimension and the second position is the index of the third dimension. If I wanted a point, I could use linear indexing. However, it is a bit trickier because I need to ignore the second row. Is there a good way to do this in Julia?

This benchmark comparison looks totally reasonable, with the expected order between functions.
Note that f returns indices, while g and h return array elements. Also, I don’t think these 2d indices from f() can be used to directly index into 3d x…