Generate a Uniform Random Integer in [0, 6] from a Biased Bit Generator

You are given a black-box function:

getRandom01Biased()

It returns 0 with probability p and 1 with probability 1 - p, where the unknown constant p satisfies 0 < p < 1. Calls ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: