Last active
May 13, 2019 10:26
-
-
Save rish-16/2dd78552031321164994336c304858f1 to your computer and use it in GitHub Desktop.
Main event for generation of random numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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