Skip to content

Instantly share code, notes, and snippets.

@rish-16
Last active May 13, 2019 10:26
Show Gist options
  • Select an option

  • Save rish-16/2dd78552031321164994336c304858f1 to your computer and use it in GitHub Desktop.

Select an option

Save rish-16/2dd78552031321164994336c304858f1 to your computer and use it in GitHub Desktop.
Main event for generation of random numbers
def rand_int():
new_job = qk.execute(circ, backend, shots=1)
# The output bitstring consists of 3 collapsed Qubits (bits)
bitstring = new_job.results().get_counts()
bitstring = list(bitstring.keys()[0])
# Converting binary to Decimal integers
random_integer = int(bitstring, 2)
return random_integer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment