DrawRandomBool operation

Fully qualified name: Std.Random.DrawRandomBool

operation DrawRandomBool(successProbability : Double) : Bool

Summary

Given a success probability, returns a single Bernoulli trial that is true with the given probability.

Input

successProbability

The probability with which true should be returned.

Output

true with probability successProbability and false with probability 1.0 - successProbability.

Example

The following Q# snippet samples flips from a biased coin:

let flips = DrawMany(DrawRandomBool, 10, 0.6);