# generation of certain matrices

I'd like to create a list of roughly 100-1000 $2 \times 2$ matrices $[A_1,A_2,...,A_N]$ that have the following properties:

$\det A_j = 1$

The entries of each $A_j$ are in an imaginary quadratic integer ring, such as $\mathbb{Z}[i]$, or $\mathbb{Z}[\sqrt{-2}]$

For example, the matrix $$\begin{bmatrix} 1&2i \\ 0&1 \end{bmatrix}$$ fits the above specifications when the ring is $\mathbb{Z}[i]$.

I know that I probably want to run some kind of loop over the entries of the matrix, but I'm not sure how to do this. Perhaps I want to initially treat the matrices as lists of length 4, and then run an iterative loop over the lists. Then, when the above specifications are met, that list is stored somewhere else. I think I'd also like to put a bound on the "size" of the matrix entries, but that should be easy to do afterwards.

Thanks!

Hmm, there is a

`random_matrix`

command which might be helpful here.