Dice and card dealing simulations.

Discussion in 'Physics & Math' started by Dinosaur, May 14, 2002.

  1. Dinosaur Rational Skeptic Valued Senior Member

    Messages:
    4,885
    Does anybody have experience with simulating Casino craps and/or dealing cards?

    Does anybody have a pseudo random number generator and/or an algorithm suitable for these purposes?

    I recently developed a Visual Basic application which simulates dealing from a 52 card deck and Casino Craps (Dice).

    I used the standard pseudo random number generator provided by VB.

    The results were interesting.

    The Dice throwing simulation got the following results after about 10 million pass line bets (about 34 million dice throws).
    • Each die simulation indicated the correct probabilities to about 5 digits of precision. True probability for each digit is 1/6 (.1666666666 . . .). Simulation indicated .16666xx for most numbers.
    • The simulated totals were precise to about 5-6 digits.
    • The probabilities of making various points were precise to slightly less than 3 digits.
    • The overall probability of winning a pass line bet was wrong in the third digit.
      True probability: .4929292929 . . . Simulated probability: .4937xxxx
    The above results seemed to have stabilized after 3-5 million pass line bets, not getting more precise as the number of dice throws increased.

    The above suggests that the pseudo random number generator did a good, but not excellent job of simulating dice throw probabilities. If it was excellent, the precision would continue to improve as the number of throws increased. It did a poor job of simulating the overall probability of wining a pass line bet.

    BTW: I wrote a similar application many years ago using a different version of the Basic language. That simulation indicated that the player should expect to beat the casino, due to bad simulation of the probabilities of making a point. For that simulation, the other simulated probabilities were fairly good.

    Making a point requires throwing a particular total before throwing a seven. Although the simulated frequencies for the various totals are fairly precise, the simulated probabilities of making a point are poor. It is like a trick question about train schedules for which the less likely event is very likely to occur first, due to unexpected clustering.

    Suppose there are ten trains each hour from Philadelphia to New York and only one train per hour from Philadelphia to Washington. Now suppose that the New York trains leave every minute starting on the hour, while the single Washington train leaves at one minute before each hour. If you arrive at a random time, the next train to leave is far more likely to be a Washington train than a New York train.

    Probability, random number generation, and simulations are fraught with subtleties, which are counter intuitive.

    The card dealing simulation was only precise to about 3 digits. This application simulated dealing 5-card poker hands & 13 card bridge hands. It also simulated drawing a single card from a 52 card deck. The Visual Basic pseudo random number generator does not do a good job of simulating the dealing of cards.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. fariz Registered Member

    Messages:
    1
    i enjoy that.So can u make a 13 digit code generator? I need it.For example i enter 13 digit valid number of special mobile phone card,then program generate other valid numbers,and i have counters on my account?If u can create sucha program pls mail me for details.Thanks!ESPANA@box.az
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. Blindman Valued Senior Member

    Messages:
    1,425
    A digital computer can not simulate a true random number sequence. Random number generators are very advanced, and there are many algorithms available.

    Most Casino games are checked by an independent body to make sure its random number generator is statically correct. (thats how it is done in Australia). This is done mostly to protect the punters.

    I remember an account of a machine that had a bad random number algorithm. The machine was paying out way to much. It was quickly discovered by the operators but not before it was exploited by a luck few.

    Fariz.
    A 48bit integer can hold a 13 digit number.
    Not to sure about your motives.
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. Crisp Gone 4ever Registered Senior Member

    Messages:
    1,339
    Hi Dinosaur,

    "Each die simulation indicated the correct probabilities to about 5 digits of precision. True probability for each digit is 1/6 (.1666666666 . . .). Simulation indicated .16666xx for most numbers."

    Which is ofcourse what you would expect because of the central limit theorem. The error in your experiment is of the order 1/sqrt(N) where N is the number of experiments. For 34 million experiments (throws) this is about 0.0001, i.e. 4 correct digits.

    Bye!

    Crisp
     
  8. Canute Registered Senior Member

    Messages:
    1,923
    Two whimsical questions.

    Has anyone ever tried 34 million actual dice throws to check our assumptions about how it actually behaves? One would expect a figure for the frequency of each number to be near as damn it .66666 but this is an average or statistical prediction, does it ever actually happen in reality? In other words are we right to assume that our random number generators must produce a figure of .66666 in order to model reality properly?

    Experimentally how many throws (on average) does it take for a real dice-throw sequence to produce an equal occurence of each number? Strange question but there ought ot be an answer.
     
  9. everneo Re-searcher Registered Senior Member

    Messages:
    2,621
    number of occurance of a particular number, over a very large period of dice throwing, could be predicted statistically. but getting the frequency of that number to occur is difficult cuz of the randomness.

    equal occurance of each number or successive occurance of that number..?

    if it is the first case the chance of equal occurance increases with no. of throws. second case is a random event.
     
  10. Canute Registered Senior Member

    Messages:
    1,923
    That's what I mean. Has anyone checked the predictions in the case of large numbers of random events. Can't be done by computer since they have out assumptions built into the programs.
    I meant this second case. Surely the probability of an equal total occurence of each number changes as the number of throws increases? Or does it remain equally probable after each group of six throws?
     
  11. ProCop Valued Senior Member

    Messages:
    1,258
    There was a thread at Sciforums about how long it would take to get 20 times six in a row. It was "tested" by a programmer slow PC (of 350 MGHz) would run a random choice dicing program for about 3.500 years to get at that. This was naturally not really run, they got to 7 sixes in a row and calculated the rest. But there was a regularity in the (encreasement) between 1 and two sixes, 2 and 3, 3 and 4, 4 and 5 etc. From the pattern of encreasing one would say there was a "pattern" and you so, possibly, can judge the "random" behaviour of the dice. (It was my impression (from that "experiment"), that you can get by 6.000.000 throughs appr. 1 mil. ones 1 mil twoes etc. Nasor may remeber that.)
     
  12. Canute Registered Senior Member

    Messages:
    1,923
    Same problem though. This is not testing real dice, it is testing a computer programmers notion of how real dice behave.
     
  13. everneo Re-searcher Registered Senior Member

    Messages:
    2,621
    Canute,

    if i give you sequence of 10 million such real dice throws (say , while serving my life term..) how can you accept that. it can't be tested for its genuinity..!

    Please Register or Log in to view the hidden image!

     
  14. Canute Registered Senior Member

    Messages:
    1,923
    I'll trust you. Anyway you don't have to convince me - the issue is whether YOU are sure you can trust human simulations of chance events to stand in for the real thing.
     
  15. everneo Re-searcher Registered Senior Member

    Messages:
    2,621
    Actually a dice throw results in 1 of the n equal possiblities. randomly selecting one of such equal possibilities is what dice throw does. it need not be necessariy dice. it could be any event resembling this situation. computer simulations fairly suit for its speed and randomness.
     
  16. Canute Registered Senior Member

    Messages:
    1,923
    So we normally assume. Incorrect asssumptions about large scale pattern formation is just what hid non-linear dynamics and chaotic behaviour from us for so long.

    Actually my question was originally tongue in cheek - but it's growing on me.
     
  17. everneo Re-searcher Registered Senior Member

    Messages:
    2,621
    ok. when it is grown enough pl put it in clear terms. outright rejection of the scientific methods viz simulations would also be considered if it has valid reasons..

    Please Register or Log in to view the hidden image!

     

Share This Page