Search Results
7/21/2025, 9:33:48 AM
>>40767524
>>40767379
Classical RNG generation is an option of this program, and it does use Python's inbuilt random, but that's a very small part of the program.
For quantum generation I use an imported Q# program called GenerateRandomBit
the code for the Q# program is this
[code]
namespace QuantumRNG {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
operation GenerateRandomBit () : Result {
// Allocate a qubit
use q = Qubit();
// Put the qubit in superposition
// It now has a 50% chance of being measured 0 or 1
H(q);
// Measure the qubit and return the result
return MResetZ(q);
}
}
>>40767379
Classical RNG generation is an option of this program, and it does use Python's inbuilt random, but that's a very small part of the program.
For quantum generation I use an imported Q# program called GenerateRandomBit
the code for the Q# program is this
[code]
namespace QuantumRNG {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
operation GenerateRandomBit () : Result {
// Allocate a qubit
use q = Qubit();
// Put the qubit in superposition
// It now has a 50% chance of being measured 0 or 1
H(q);
// Measure the qubit and return the result
return MResetZ(q);
}
}
Page 1