Maybe something like:
using StatsBase
x = rand(10, 5, 3)
@views sample(CartesianIndices(x[:,1,:]), 3; replace=false)
3-element Vector{CartesianIndex{2}}:
CartesianIndex(1, 3)
CartesianIndex(5, 2)
CartesianIndex(4, 2)
Maybe something like:
using StatsBase
x = rand(10, 5, 3)
@views sample(CartesianIndices(x[:,1,:]), 3; replace=false)
3-element Vector{CartesianIndex{2}}:
CartesianIndex(1, 3)
CartesianIndex(5, 2)
CartesianIndex(4, 2)