r = qrandom(4,0); if (f(r) == 1) invert_phase(); r = qrandom(4,r); if (r==0) invert_phase(); r = qrandom(4,r); print(r);