Add a utility function for generating the random square matrix of certain size