home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!newcastle.ac.uk!tuda!dph3gds
- From: Graham.Shaw@newcastle.ac.uk (G.D.Shaw)
- Newsgroups: comp.programming
- Subject: Re: FULL HOUSE
- Message-ID: <BuJBAr.A25@newcastle.ac.uk>
- Date: 13 Sep 92 20:52:03 GMT
- References: <1992Sep13.144411.25033@wuecl.wustl.edu>
- Organization: University of Newcastle upon Tyne, UK NE1 7RU
- Lines: 33
- Nntp-Posting-Host: tuda
-
- In article <1992Sep13.144411.25033@wuecl.wustl.edu> ppc1@cec1.wustl.edu (Peter Pui Tak Chiu) writes:
- >
- >hi everyone,
- >
- >i am trying to find the probability of getting a hand of full house from a
- >shuffled deck of 52 cards.
- >
- >...
- >
- >but i wrote a c program to calculate this probability and the results turn
- >out to be very different.
- >
- To summarise your dealing algorithm:
-
- - you choose five random numbers between 0 and 12
- - you then throw away any hand where all five numbers are the same.
-
- Suppose, for example, the first card you choose is a ten.
-
- The probability of drawing a ten as the second card, by the above
- algorithm, is still 1 in 13. Unfortunately, this will not work:
- having drawn one ten, there are only 3 tens left in the remaining
- pack of 51 cards, so the probability of a ten should be 3/51, and
- of any other card should be 4/51.
-
- To solve the problem correctly, you must keep track of exactly
- which cards remain in the pack, and assign each of those cards an
- equal probability. Note that this also avoids the need to test
- each hand for legality after it has been dealt, as it ensures
- that such combinations cannot occur.
-
- Graham Shaw (dph3gds@tuda.ncl.ac.uk)
- Department of Physics, Durham University, England
-