Skip to content

Instantly share code, notes, and snippets.

@gnh1201
Created November 30, 2018 14:10
Show Gist options
  • Save gnh1201/e0b7359c31f284e18ba6634ca1de2d75 to your computer and use it in GitHub Desktop.
Save gnh1201/e0b7359c31f284e18ba6634ca1de2d75 to your computer and use it in GitHub Desktop.
Quantum computing simple mockup in javascript
// Quantum computing simple mockup in javascript
// Go Namhyeon <[email protected]>
// https://github.com/gnh1201
function make_qubit() {
var a = ((Math.random() / Math.random()) > Math.random()); // qubit first bit
var b = ((Math.random() / Math.random()) > Math.random()); // qubit second bit
var c = ((Math.random() / Math.random()) > Math.random()); // qubit third bit
var qubit = [a, b, c];
return qubit;
}
for(var i = 0; i < 1000; i++) {
var qubit = make_qubit();
console.log("first: " + qubit[0] + ", second: " + qubit[1] + ", third: " + qubit[2]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment