home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / programm / 2599 < prev    next >
Encoding:
Internet Message Format  |  1992-09-13  |  1.6 KB

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