Fun puzzle: You have a coin that turns up heads with probability p, 0 < p < 1. Y...
Dan Piponi @dpiponi@mathstodon.xyz
Fun puzzle:
You have a coin that turns up heads with probability p, 0 < p < 1. You don't know p. How can we use this to generate a random variable that is 0 or 1, and is 1 with *precisely* probability exp(-p)? You're allowed auxiliary random number generators that sample any distribution you like. And your "algorithm" is allowed to fail to terminate but only with probability zero.
For a small bonus do it without the auxiliary random number generators. (Too easy maybe.)