Added code to generate random matrices