Created
February 20, 2022 23:03
-
-
Save Israel-Miles/8275732b8ca6b75238cb43c00e6d2c99 to your computer and use it in GitHub Desktop.
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
operation RandomBit () : Int { | |
// Allocate single qubit | |
use q = Qubit(); | |
// Set qubit in superposition state with a Hadamard gate | |
H(q); | |
// Measuring state of qubit and return integer value of result | |
return (M(q) == Zero) ? 0 | 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment