qsharp icon indicating copy to clipboard operation
qsharp copied to clipboard

DrawRandomBool missing in the new QDK

Open filipw opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. DrawRandomBool is no longer available. On the other hand, both DrawRandomInt and DrawRandomDouble are there.

Describe the solution you'd like I think it would be useful to have it back for backwards compatibility. I also found it helpful in educational scenarios to orchestrate some parts of the program that required random conditions (especially in the classical part of a hybrid program). It was also nice to be able to pass success probability into it.

Describe alternatives you've considered

DrawRandomBool(0.5) can be replaced with DrawRandomInt(0, 1) == 1 DrawRandomBool(successProbability) be replaced with DrawRandomDouble(0.0, 1.0) < successProbability

Of course a measurement of a qubit in a specific superposition could also be used.

filipw avatar Feb 16 '24 06:02 filipw