The following program gives you an integral *n* by *n* matrix with eigenvalues in the Gaussian integers (that is *Z[i]* ) where the real and imaginary part are in the interval *[-m,m]*. You can change n and m by editing the code below. You can make the eigenvalues non-complex by replacing the *1/2* in the first if-query by one or force them all to be complex by replacing it by zero.

Since I had problems with the comments in this SageMathCell, I deleted them. You can find the commented sourcecode here as a public project in the SageMathCloud.