🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.puzzles
Article #2573

Re: Unfair coin (CORRECTION)

#2573
From: Dave Dodson
Date: Thu, 07 Jan 1993 18:54
69 lines
4295 bytes
In article <C0G2Mv.4yq@hplntx.hpl.hp.com> potamian@hpl.hp.com (Spyros Potamianos) writes:
>Oooooooooops! I made a mistake in my previous posting about approximating
>an arbitrary probability with an unfair coin. The number of tosses you
>need is always unbounded (not finite).
>You see, what happened is that in my mind I broke the problem in two
>subproblems:
>    a) simulate a fair coin using an unfair coin
>    b) generate P (or an approximation to it) from a fair coin
>
>For some values of P (b) only needs a finite number of tosses (e.g.
>P=0.25). However when combining both (a) and (b) to form the problem I
>posted then the number of tosses is obviously unbounded....
>However the average number of tosses you need is still finite.

It is not necessary to simulate a fair coin if you know the probability
of heads and tails for the unfair coin.  And since the original problem
description (which has expired on our machine) contained a tolerance,
you can quit after a finite number of steps.

For example, if the unfair coin comes up tails 10% of the time and heads
90% of the time, and you want to approximate a probability of 0.2 to within
a tolerance of one part in a million, use the following rules in order, one
for each flip of the coin.

If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, keep rolling;   if heads, report failure
If tails, report success; if heads, keep rolling
If tails, keep rolling;   if heads, report failure
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, keep rolling;   if heads, report failure
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, keep rolling;   if heads, report failure
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, keep rolling
If tails, report success; if heads, report failure

Reporting success or failure means that you stop the process.

As another example with the same coin, to approximate 0.19

If tails, report success; if heads, keep rolling
If tails, report success; if heads, report failure

----------------------------------------------------------------------

Dave Dodson		                             dodson@convex.COM
Convex Computer Corporation      Richardson, Texas      (214) 497-4234
Technical Details
Message-ID: <1993Jan7.185427.22133@news.eng.convex.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.gtech.com!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!yale.edu!jvnc.net!newsserver.jvnc.net!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!dodson
References: <C0G2Mv.4yq@hplntx.hpl.hp.com>

Show Full Headers
Complete Article Headers
Newsgroups: rec.puzzles
Path: arc1-ca.pugleaf.net!sparky!uunet!news.gtech.com!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!yale.edu!jvnc.net!newsserver.jvnc.net!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!dodson
From: Dave Dodson <dodson@convex.COM>
Subject: Re: Unfair coin (CORRECTION)
Originator: dodson@bach.convex.com
Sender: usenet@news.eng.convex.com (news access account)
Message-ID: <1993Jan7.185427.22133@news.eng.convex.com>
Date: Thu, 7 Jan 1993 18:54:27 GMT
Reply-To: dodson@convex.COM (Dave Dodson)
References: <C0G2Mv.4yq@hplntx.hpl.hp.com>
Nntp-Posting-Host: bach.convex.com
Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.
Lines: 69