+ Reply to Thread
Results 1 to 6 of 6

Random Number Generation

  1. #1
    MB06
    Guest

    Random Number Generation

    I am trying to simulate the results of 120 consecutive roulette wheel spins.
    There are 36 numbers on a roulette table, plus a "0" and a "00". So,
    inherently, a 1/38 chance that any given number will be the result of a spin.
    I set the Random Number Generator to "Bernoulli" and a p-value of ".5" to
    get the odds of a black v. red result, but this is not accurate because of
    the "0" and "00" on the wheel. If anyone knows how to ask excel to randomly
    generate 38 different potential results, please email me back. Also, I would
    need a formula to translate each number to its corresponding color. I don't
    know if an "IF" statement would work here, or what is best, but I am
    interested to hear the thoughts of experts.

  2. #2
    Gary L Brown
    Guest

    RE: Random Number Generation

    =INT((RAND()*38)-0.00001)
    where 37 = "00"

    If the above formula is in A1 then...
    =IF(MOD(A2,2)=0,"Black","Red")

    Since I don't know roulette, I am 'assuming' even is blank and odd is red.
    If it's the other way around just switch the descriptions in the formula.
    Hope "00" is Red :O>

    HTH,
    --
    Gary Brown
    gary_brown@ge_NOSPAM.com
    If this post was helpful, please click the ''Yes'' button next to ''Was this
    Post Helpfull to you?''.


    "MB06" wrote:

    > I am trying to simulate the results of 120 consecutive roulette wheel spins.
    > There are 36 numbers on a roulette table, plus a "0" and a "00". So,
    > inherently, a 1/38 chance that any given number will be the result of a spin.
    > I set the Random Number Generator to "Bernoulli" and a p-value of ".5" to
    > get the odds of a black v. red result, but this is not accurate because of
    > the "0" and "00" on the wheel. If anyone knows how to ask excel to randomly
    > generate 38 different potential results, please email me back. Also, I would
    > need a formula to translate each number to its corresponding color. I don't
    > know if an "IF" statement would work here, or what is best, but I am
    > interested to hear the thoughts of experts.


  3. #3
    ben
    Guest

    RE: Random Number Generation

    actually 00 is green lol

    --
    When you lose your mind, you free your life.
    Ever Notice how we use '' for comments in our posts even if they aren''t
    expected to go into the code?


    "Gary L Brown" wrote:

    > =INT((RAND()*38)-0.00001)
    > where 37 = "00"
    >
    > If the above formula is in A1 then...
    > =IF(MOD(A2,2)=0,"Black","Red")
    >
    > Since I don't know roulette, I am 'assuming' even is blank and odd is red.
    > If it's the other way around just switch the descriptions in the formula.
    > Hope "00" is Red :O>
    >
    > HTH,
    > --
    > Gary Brown
    > gary_brown@ge_NOSPAM.com
    > If this post was helpful, please click the ''Yes'' button next to ''Was this
    > Post Helpfull to you?''.
    >
    >
    > "MB06" wrote:
    >
    > > I am trying to simulate the results of 120 consecutive roulette wheel spins.
    > > There are 36 numbers on a roulette table, plus a "0" and a "00". So,
    > > inherently, a 1/38 chance that any given number will be the result of a spin.
    > > I set the Random Number Generator to "Bernoulli" and a p-value of ".5" to
    > > get the odds of a black v. red result, but this is not accurate because of
    > > the "0" and "00" on the wheel. If anyone knows how to ask excel to randomly
    > > generate 38 different potential results, please email me back. Also, I would
    > > need a formula to translate each number to its corresponding color. I don't
    > > know if an "IF" statement would work here, or what is best, but I am
    > > interested to hear the thoughts of experts.


  4. #4
    Tom Ogilvy
    Guest

    Re: Random Number Generation

    Roulette

    If you run this, it will generate 250 spins of the wheel and plot them on
    the activesheet. I do 250 just to "insure" I get at least one of each
    number. The plotting is just to demonstrate that it is doing the right
    thing (although the row and column numbers will be helpful to account for
    the other types of betting.). You should be able to adapt it to your
    purposes

    Sub abc()
    Dim results As Long, sRes As String
    Dim sCol As String
    Columns("A:D").Clear
    For i = 1 To 250
    results = Int(Rnd() * 38 + 1) - 2
    If results = -1 Then
    sRes = "00"
    Else
    sRes = CStr(results)
    End If


    Select Case results
    Case -1, 0
    sCol = "Green"
    Case 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, _
    21, 23, 25, 27, 30, 32, 34, 36
    sCol = "Red"
    Case 2, 4, 6, 8, 10, 11, 13, 15, 17, 20, _
    22, 24, 26, 28, 29, 31, 33, 35
    sCol = "Black"
    End Select
    If sRes = "00" Or sRes = "0" Then
    rw = 0
    col = 0
    Else
    rw = Int((results - 1) / 3) + 1
    col = ((results - 1) Mod 3) + 1
    End If
    If rw <> 0 And col <> 0 Then
    With Cells(rw + 1, col)
    .Value = results
    If sCol = "Red" Then
    .Interior.ColorIndex = 3
    .Font.ColorIndex = 2
    .Font.Bold = True
    ElseIf sCol = "Black" Then
    .Interior.ColorIndex = 1
    .Font.ColorIndex = 2
    .Font.Bold = True
    End If
    End With
    Else
    If sRes = "00" Then
    With Cells(1, 3)
    .Value = "'00"
    .Interior.ColorIndex = 10
    .Font.ColorIndex = 2
    .Font.Bold = True
    End With
    Else
    With Cells(1, 1)
    .Value = "'0"
    .Interior.ColorIndex = 10
    .Font.ColorIndex = 2
    .Font.Bold = True
    End With
    End If
    End If
    With Columns("A:C")
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlBottom
    End With
    Next i

    End Sub



    This generates 250 spins and maps each to a worksheet.


    --
    Regards,
    Tom Ogilvy

    "MB06" <[email protected]> wrote in message
    news:[email protected]...
    > I am trying to simulate the results of 120 consecutive roulette wheel

    spins.
    > There are 36 numbers on a roulette table, plus a "0" and a "00". So,
    > inherently, a 1/38 chance that any given number will be the result of a

    spin.
    > I set the Random Number Generator to "Bernoulli" and a p-value of ".5" to
    > get the odds of a black v. red result, but this is not accurate because of
    > the "0" and "00" on the wheel. If anyone knows how to ask excel to

    randomly
    > generate 38 different potential results, please email me back. Also, I

    would
    > need a formula to translate each number to its corresponding color. I

    don't
    > know if an "IF" statement would work here, or what is best, but I am
    > interested to hear the thoughts of experts.




  5. #5
    Tom Ogilvy
    Guest

    Re: Random Number Generation

    Colors don't conform to even and odd since that is a different bet.

    --
    Regards,
    Tom Ogilvy


    "Gary L Brown" <gary_brown@ge_NOSPAM.com> wrote in message
    news:[email protected]...
    > =INT((RAND()*38)-0.00001)
    > where 37 = "00"
    >
    > If the above formula is in A1 then...
    > =IF(MOD(A2,2)=0,"Black","Red")
    >
    > Since I don't know roulette, I am 'assuming' even is blank and odd is red.
    > If it's the other way around just switch the descriptions in the formula.
    > Hope "00" is Red :O>
    >
    > HTH,
    > --
    > Gary Brown
    > gary_brown@ge_NOSPAM.com
    > If this post was helpful, please click the ''Yes'' button next to ''Was

    this
    > Post Helpfull to you?''.
    >
    >
    > "MB06" wrote:
    >
    > > I am trying to simulate the results of 120 consecutive roulette wheel

    spins.
    > > There are 36 numbers on a roulette table, plus a "0" and a "00". So,
    > > inherently, a 1/38 chance that any given number will be the result of a

    spin.
    > > I set the Random Number Generator to "Bernoulli" and a p-value of ".5"

    to
    > > get the odds of a black v. red result, but this is not accurate because

    of
    > > the "0" and "00" on the wheel. If anyone knows how to ask excel to

    randomly
    > > generate 38 different potential results, please email me back. Also, I

    would
    > > need a formula to translate each number to its corresponding color. I

    don't
    > > know if an "IF" statement would work here, or what is best, but I am
    > > interested to hear the thoughts of experts.




  6. #6
    Gary L Brown
    Guest

    RE: Random Number Generation

    Why does everyone know roulette but me :O<
    I guess it shows that I don't hang around with Wayne Gretsky and his wife :O>
    Have a great weekend!
    --
    Gary Brown




    "MB06" wrote:

    > I am trying to simulate the results of 120 consecutive roulette wheel spins.
    > There are 36 numbers on a roulette table, plus a "0" and a "00". So,
    > inherently, a 1/38 chance that any given number will be the result of a spin.
    > I set the Random Number Generator to "Bernoulli" and a p-value of ".5" to
    > get the odds of a black v. red result, but this is not accurate because of
    > the "0" and "00" on the wheel. If anyone knows how to ask excel to randomly
    > generate 38 different potential results, please email me back. Also, I would
    > need a formula to translate each number to its corresponding color. I don't
    > know if an "IF" statement would work here, or what is best, but I am
    > interested to hear the thoughts of experts.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1