Reputation: 21
How to find a random node from a matrix which contains all the nodes?
Upvotes: 0
Views: 145
Reputation: 105
I will take a wild guess here and assume that you want to pick a random (i,j) entry from a MxN matrix A.
Initialize i and j using floor(M*rand(1,1)) and floor(N*rand(1,1)), respectively. Then call A(i,j).
Upvotes: 1