Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roulette simulator

    Dear users,

    I need to create a roulette simulator for teaching purposes. Particularly, I would like to estimate the probability that a player is in a winning position after n spins. Is there anyone who can point me to any article, forum, blog, code where I can read more on the topic?

    Thank you,
    Fede
    Last edited by federico zampi; 02 Feb 2017, 09:46.

  • #2
    To just simulate a roulette wheel is simple enough. The roulette outcomes range from 1 through 36 plus 0 (and in some traditions 00), so a total of 37 or 38 possible outcomes.

    Code:
    clear*
    set seed 1234 // OR YOUR FAVORITE SEED
    
    set obs 10000 // OR YOUR DESIRED SAMPLE SIZE
    gen spin = floor(37*runiform())
    But when you talk about the probability that a plays is in a winning position, you are also talking about simulating the betting strategy of the player--and I don't know enough about gambling behavior to suggest any useful model for that.

    Comment


    • #3
      I suspect you're thinking of a sort of Monte Carlo analysis where you specify the betting routine and then look at the distribution after x plays. Stata has a simulate procedure for this sort of thing. Alternatively, you can build a loop around Clyde's code and save the output into a set of new variables.

      Comment

      Working...
      X