For my dissertation I need to simulate random circuits and I have been trying to use google Cirq for that. Looking at the documentation I have seen how to create my own circuit and simulate it, but it becomes exhausting and prone to error the fact of creating a circuit for a larger number of quits and to produce as much entanglement as possible.

I thought that Cirq would have any method for generating a random circuit for a given number of qubits, but unfortunately have not found anything like this. Therefore, I was wondering whether there is any tool or anyone who has generated circuits that I could import to use.

  • 2
    $\begingroup$ Is this what you are looking for? $\endgroup$
    – epelaez
    Commented Oct 8, 2021 at 12:34

1 Answer 1


Cirq does have some methods for generating random circuits, such as cirq.testing.random_circuit and cirq.random_rotations_between_grid_interaction_layers_circuit.

That being said, in my experience, generic random circuit methods almost never do quite exactly what I need. I suspect that, for thesis-level work, you will need much more careful control over the generated circuit than you will get from a method written by anyone except you.

  • $\begingroup$ The first thing I have To do is simulate the circuit, obtain the amplitudes of the wavefunction and use Fourier decomposition to obtain the probability function for sampling the random circuit. I believe the second method that you wrote is what I am looking for! Thank you so much for it. I was looking for different method names so I will have to be a bit more careful in the future. $\endgroup$
    – Pablo
    Commented Oct 10, 2021 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.