Quote Originally Posted by 2kaud View Post
Possibly the easiest way is to replace spin(...) by matrix[...].

Another way would be to use a define at the top of the code
Code:
#define spin(x,y) (matrix[(x), (y)])
Should this go in the second part or first part of the code?
Because in first section of the code to generate NxN lattice I already defined matrix to be [LatSize][LatSize]:

Code:
const int LatSize = 5;
const int L = LatSize * LatSize;
int matrix[LatSize][LatSize];

int matrix[LatSize][LatSize];
srand ( static_cast<unsigned> ( time ( 0 ) ) );
for ( int i = 0; i < LatSize; i++ ) 
{
for ( int j = 0; j < LatSize; j++ )
{
matrix[i][j] = rand () % 2 *2-1;
}
}