wrote random matrix generator