# One qubit. Put it in a mix of 0 and 1, then measure it many times.
from tiny_qsim import Random, H, start, apply, show, measure, label

state = start(1)
print("A new qubit is 0:")
show(state, 1)

apply(state, H, 0, 1)
print("After a Hadamard gate it is half 0 and half 1:")
show(state, 1)

counts = measure(state, 1000, Random(2026))
print("Measured 1000 times. Each look gives only 0 or 1:")
for i in range(len(counts)):
    print(f"  {label(i, 1)}: {counts[i]}")
