Finding the length of the number of paths in a matrix
Don't do using namespace std;.




void printPath() {

}



This empty function does not do anything, so better remove it to make the code cleaner.




// Print matrix to see contents
//  for(int i = 0; i &lt; m; i++) {
//      for(int j = 0; j &lt; n; j++) {
//          cout &lt;&lt; matrix[i][j] &lt;&lt; " ";
//      }
//      cout &lt;&lt; endl;
//  }
//  cout &lt;&lt; endl;



Commented code clutters the code and can confuse the reader. "Is it still needed? Then why is it commented out? If not, why is it still there?". Apparently it is not used anymore, and it also tells the reader nothing about the code, so better delete it.




// Specify the number of rows and columns of the matrix
int n = MATRIX_SIZE;
int m = MATRIX_SIZE;



The comment here should not be needed, because the code explains itself. Maybe it would be even more explicit if you named the variables rows and columns. If n and m do not change, and you have MATRIX_SIZE defined anyways, you could just use MATRIX_SIZE instead of the variables.




// Declare random number generator
mt19937 gen(10);
uniform_int_distribution&lt;&gt; dis(1, 1000000);



A more explicit variable name would make this comment obsolete. Less comments means less to read and makes the code easier to understand. Comments should tell the reader why the code does something, but the code should explain what it does itself. rng would be short and is a well known acronym for random number generator.