# cirq.testing.random_unitary¶

cirq.testing.random_unitary(dim: int) → numpy.ndarray[source]

Returns a random unitary matrix distributed with Haar measure.

Parameters: dim – The width and height of the matrix. The sampled unitary matrix.

References

‘How to generate random matrices from the classical compact groups’ http://arxiv.org/abs/math-ph/0609050