# How to make “random U3” in QASM?

I want to make an operator:

$$\mathrm{U3}(\arccos(\sqrt p),0,0)$$, when $$p$$ is a random value between $$0$$ and $$1$$

How do I write code in QASM language of this "random $$\mathrm{U3}$$" operator?

• Can you not use the PRNG from a different package in the same language that QASM is written in? – AHusain Oct 7 '18 at 23:44
• Do you want to have a random and unknown gate of this sort for a uniformly distributed $p$, which amounts to a $Y$ rotation by a random angle between $0$ and $\pi/2$ with some particular non-uniform distribution? – Niel de Beaudrap Oct 8 '18 at 11:13
• I want just that it will be U3, and p will be random as I write above. I know how to write this one in qiskit language but I have problem in writing this random U3 in Qasm. I want to run some code that include this random operator and a algorithm that I know how to program only in Qasm language.... – Daniel Vainshtein Oct 8 '18 at 17:02
• for example I use the random operation in qiskit, the random is coming from the python language as the qiskit is just an extantion of python basic gates and operations... – Daniel Vainshtein Oct 8 '18 at 17:07
• QASM is a very low level language and it is not possible to do so (instructions are determined when submitted). Your only way is just to generate QASM files and use another tool with a random generator. You finally just write your QASM file with the random p generated. You can look also at this code for a random QASM generator : github.com/Qiskit/qiskit-terra/blob/master/tools/… – cnada Oct 8 '18 at 19:02