Welcome Guest
Log In | Register )
You last visited January 24, 2017, 8:11 am
All times shown are
Eastern Time (GMT-5:00)

How to simulate a distribution and use the lottery's own randomness against itself.

211 replies. Last post 16 days ago by tvpventures.

Page 1 of 15
4.818
PrintE-mailLink
JADELottery's avatar - YingYangYong 01.PNG
The Quantum Master
West Concord, MN
United States
Member #21
December 7, 2001
3685 Posts
Online
Posted: May 22, 2015, 11:16 am - IP Logged

We're going to start posting in a bit.

We ask that you hold on any questions till we are finished.

If we have more to to post, you'll see a 'Continues...' at the bottom of the post.

When we are done, we will post '...Done.' at the bottom of the page.

This takes several posts because of the large number of graphs and tables.

We tried to post in one gigantic post once and it caused problems loading.

In the end we will be posting an Excel Function that can be copied and pasted into Excel to be used in Excel or modified to suite any programming language you'd like to use.

Continues...

Presented 'AS IS' and for Entertainment Purposes Only.
Any gain or loss is your responsibility.
Use at your own risk.

Order is a Subset of Chaos
Knowledge is Beyond Belief
Wisdom is Not Censored
Douglas Paul Smallish
Jehocifer

    JADELottery's avatar - YingYangYong 01.PNG
    The Quantum Master
    West Concord, MN
    United States
    Member #21
    December 7, 2001
    3685 Posts
    Online
    Posted: May 22, 2015, 11:46 am - IP Logged

    We will use Mega Millions' Mega Ball and the Three Sum topic we posted as an example.

    The Mega Ball Three Sum distribution table is displayed below with a chart.

    Three SumCount
    10
    20
    31
    43
    56
    610
    715
    821
    928
    1036
    1145
    1255
    1366
    1478
    1591
    16105
    17120
    18133
    19144
    20153
    21160
    22165
    23168
    24169
    25168
    26165
    27160
    28153
    29144
    30133
    31120
    32105
    3391
    3478
    3566
    3655
    3745
    3836
    3928
    4021
    4115
    4210
    436
    443
    451

     

     

    Given the distribution table, the first step in simulating this distribution is the integrate the table by adding the lowest count to the next higher one.

    Continues...

    Presented 'AS IS' and for Entertainment Purposes Only.
    Any gain or loss is your responsibility.
    Use at your own risk.

    Order is a Subset of Chaos
    Knowledge is Beyond Belief
    Wisdom is Not Censored
    Douglas Paul Smallish
    Jehocifer

      JADELottery's avatar - YingYangYong 01.PNG
      The Quantum Master
      West Concord, MN
      United States
      Member #21
      December 7, 2001
      3685 Posts
      Online
      Posted: May 22, 2015, 11:49 am - IP Logged

      The table below show the sum Count and the Integration.

      Three SumCountIntegrated
      100
      200
      311
      434
      5610
      61020
      71535
      82156
      92884
      1036120
      1145165
      1255220
      1366286
      1478364
      1591455
      16105560
      17120680
      18133813
      19144957
      201531110
      211601270
      221651435
      231681603
      241691772
      251681940
      261652105
      271602265
      281532418
      291442562
      301332695
      311202815
      321052920
      33913011
      34783089
      35663155
      36553210
      37453255
      38363291
      39283319
      40213340
      41153355
      42103365
      4363371
      4433374
      4513375

       

      The Integrated graph.

       

      Next we need to Normalize the Integration for use with random selection.

      Continues...

      Presented 'AS IS' and for Entertainment Purposes Only.
      Any gain or loss is your responsibility.
      Use at your own risk.

      Order is a Subset of Chaos
      Knowledge is Beyond Belief
      Wisdom is Not Censored
      Douglas Paul Smallish
      Jehocifer

        JADELottery's avatar - YingYangYong 01.PNG
        The Quantum Master
        West Concord, MN
        United States
        Member #21
        December 7, 2001
        3685 Posts
        Online
        Posted: May 22, 2015, 11:57 am - IP Logged

        Normalization of the Integration is simply making the values greater than or equal to 0, and less than or equal to 1.

        This is done by finding the Maximum value in the Integration and dividing all the Integration values by that Maximum.

        The table shows the Normalized Integration.

        Three SumCountIntegratedNormalized
        1000
        2000
        3110.000296296
        4340.001185185
        56100.002962963
        610200.005925926
        715350.01037037
        821560.016592593
        928840.024888889
        10361200.035555556
        11451650.048888889
        12552200.065185185
        13662860.084740741
        14783640.107851852
        15914550.134814815
        161055600.165925926
        171206800.201481481
        181338130.240888889
        191449570.283555556
        2015311100.328888889
        2116012700.376296296
        2216514350.425185185
        2316816030.474962963
        2416917720.525037037
        2516819400.574814815
        2616521050.623703704
        2716022650.671111111
        2815324180.716444444
        2914425620.759111111
        3013326950.798518519
        3112028150.834074074
        3210529200.865185185
        339130110.892148148
        347830890.915259259
        356631550.934814815
        365532100.951111111
        374532550.964444444
        383632910.975111111
        392833190.983407407
        402133400.98962963
        411533550.994074074
        421033650.997037037
        43633710.998814815
        44333740.999703704
        45133751

         

        Now we can use the Normalized table with a random number generator to simulate a Three Sum selection.

        Continues...

        Presented 'AS IS' and for Entertainment Purposes Only.
        Any gain or loss is your responsibility.
        Use at your own risk.

        Order is a Subset of Chaos
        Knowledge is Beyond Belief
        Wisdom is Not Censored
        Douglas Paul Smallish
        Jehocifer

          JADELottery's avatar - YingYangYong 01.PNG
          The Quantum Master
          West Concord, MN
          United States
          Member #21
          December 7, 2001
          3685 Posts
          Online
          Posted: May 22, 2015, 12:06 pm - IP Logged

          Most computers have a random generator that can spit out a value that is greater than or equal to 0, and less than 1.

          This works Great, because all we have do to find a properly selected Three Sum based on a known distribution is to do a reverse find using the random number and the Normalized Integration.

          The graph below shows how we start at the left with some random place in the Y axis (Maximum Proportional) and move to the bar graph then move down to the X axis (Three Sum) to find the sum.

          The Red, Green and Blue arrows show some random selections.

          Continues...

          Presented 'AS IS' and for Entertainment Purposes Only.
          Any gain or loss is your responsibility.
          Use at your own risk.

          Order is a Subset of Chaos
          Knowledge is Beyond Belief
          Wisdom is Not Censored
          Douglas Paul Smallish
          Jehocifer

            JADELottery's avatar - YingYangYong 01.PNG
            The Quantum Master
            West Concord, MN
            United States
            Member #21
            December 7, 2001
            3685 Posts
            Online
            Posted: May 22, 2015, 12:16 pm - IP Logged

            So, how well does this work?

            We have setup a function in Excel that takes the Three Sums and its Distribution, then randomly selects a sum based on that distribution.

            We simulated 1,500 samples to see how well this would fit the know distribution.

            For 1,500 samples, the theoretical distribution is displayed in the graph below.

             

            Our 1,500 sample run produced the following distribution.

             

            Continues...

            Presented 'AS IS' and for Entertainment Purposes Only.
            Any gain or loss is your responsibility.
            Use at your own risk.

            Order is a Subset of Chaos
            Knowledge is Beyond Belief
            Wisdom is Not Censored
            Douglas Paul Smallish
            Jehocifer

              JADELottery's avatar - YingYangYong 01.PNG
              The Quantum Master
              West Concord, MN
              United States
              Member #21
              December 7, 2001
              3685 Posts
              Online
              Posted: May 22, 2015, 12:23 pm - IP Logged

              Now the Excel Function, Here It IS!!!

              ____________________________________________________________________________________________________

              Function Disimulate(ByVal theNumbers As Range, ByVal theDistribution As Range) As Variant
              On Error GoTo exitfunction
              If (theNumbers.Columns.Count > 1) Or (theDistribution.Columns.Count > 1) Or (theNumbers.Rows.Count <> theDistribution.Rows.Count) Then Disimulate = 0
              Dim a As Long
              Dim d(), r, sum As Double
              ReDim d(theDistribution.Rows.Count)
              d(0) = 0: sum = 0
              For a = 1 To theDistribution.Rows.Count
              sum = d(a - 1) + theDistribution.Cells(a, 1)
              d(a) = sum
              Next a
              For a = 0 To theDistribution.Rows.Count
              d(a) = d(a) / sum
              Next a
              r = Rnd()
              a = 0
              Do
              a = a + 1
              Loop Until (r >= d(a - 1)) And (r < d(a))
              Disimulate = theNumbers.Cells(a, 1)
              Exit Function
              exitfunction:
              Disimulate = 0
              End Function

              ____________________________________________________________________________________________________

              Just copy and paste what's between the lines into Excel for those that know what they are doing.

              There's more, yep.

              Continues...

              Presented 'AS IS' and for Entertainment Purposes Only.
              Any gain or loss is your responsibility.
              Use at your own risk.

              Order is a Subset of Chaos
              Knowledge is Beyond Belief
              Wisdom is Not Censored
              Douglas Paul Smallish
              Jehocifer

                JADELottery's avatar - YingYangYong 01.PNG
                The Quantum Master
                West Concord, MN
                United States
                Member #21
                December 7, 2001
                3685 Posts
                Online
                Posted: May 22, 2015, 12:34 pm - IP Logged

                How's it work?

                The function is =Disimulate(Numbers, Distribution)

                The numbers you're looking to select are a single column in the sheet placed in you guessed it, Numbers.

                The distribution you're looking to simulate goes in, yep, Distribution.

                Don't for get to lock the position of the Numbers and Distribution cells using '$' like $A$1:$A$45 to prevent it from moving when copying the Disimulate function to another cell.

                The function will kick out a Number at random once.

                If you need to get more selection in the same place, copy over the same cells you are looking to simulate.

                Continues...

                Presented 'AS IS' and for Entertainment Purposes Only.
                Any gain or loss is your responsibility.
                Use at your own risk.

                Order is a Subset of Chaos
                Knowledge is Beyond Belief
                Wisdom is Not Censored
                Douglas Paul Smallish
                Jehocifer

                  JADELottery's avatar - YingYangYong 01.PNG
                  The Quantum Master
                  West Concord, MN
                  United States
                  Member #21
                  December 7, 2001
                  3685 Posts
                  Online
                  Posted: May 22, 2015, 12:45 pm - IP Logged

                  And finally, the best part of this function.

                  Simulating the lottery's own random selection.

                  It simple, get a distribution of numbers and plug it into the function.

                  We used the Mega Ball for this demonstration.

                  The current distribution of the Mega Ball as of 2015-05-22 @ 11:39 CT is:

                  MBReal
                  112
                  211
                  317
                  48
                  58
                  613
                  717
                  88
                  910
                  1010
                  1111
                  1210
                  138
                  147
                  1515

                   

                  We ran a sample set for the same number of draws going back to 2013-10-22 and simulated the following.

                  MBRealSimulated
                  11215
                  21115
                  31715
                  483
                  588
                  61315
                  71714
                  888
                  9108
                  10108
                  111113
                  12109
                  1389
                  1477
                  151518

                   

                  Pretty close, Aye!

                  Also, the best part about this function is no matter what the lottery does, the function adapts instantly.

                  ...Done.

                  Presented 'AS IS' and for Entertainment Purposes Only.
                  Any gain or loss is your responsibility.
                  Use at your own risk.

                  Order is a Subset of Chaos
                  Knowledge is Beyond Belief
                  Wisdom is Not Censored
                  Douglas Paul Smallish
                  Jehocifer

                    RJOh's avatar - chipmunk
                    mid-Ohio
                    United States
                    Member #9
                    March 24, 2001
                    19904 Posts
                    Offline
                    Posted: May 22, 2015, 3:20 pm - IP Logged

                    And finally, the best part of this function.

                    Simulating the lottery's own random selection.

                    It simple, get a distribution of numbers and plug it into the function.

                    We used the Mega Ball for this demonstration.

                    The current distribution of the Mega Ball as of 2015-05-22 @ 11:39 CT is:

                    MBReal
                    112
                    211
                    317
                    48
                    58
                    613
                    717
                    88
                    910
                    1010
                    1111
                    1210
                    138
                    147
                    1515

                     

                    We ran a sample set for the same number of draws going back to 2013-10-22 and simulated the following.

                    MBRealSimulated
                    11215
                    21115
                    31715
                    483
                    588
                    61315
                    71714
                    888
                    9108
                    10108
                    111113
                    12109
                    1389
                    1477
                    151518

                     

                    Pretty close, Aye!

                    Also, the best part about this function is no matter what the lottery does, the function adapts instantly.

                    ...Done.

                    Based on the above information if I was going to only play one mega ball in tonight's drawing which one would give me my best opportunity for a win on every ticket?  Picking the winning megaball means every ticket is free and I would be playing with the lottery's money.

                     * you don't need to buy more tickets, just buy a winning ticket * 
                       
                                 Evil Looking       

                      JADELottery's avatar - YingYangYong 01.PNG
                      The Quantum Master
                      West Concord, MN
                      United States
                      Member #21
                      December 7, 2001
                      3685 Posts
                      Online
                      Posted: May 22, 2015, 3:49 pm - IP Logged

                      Based on the above information if I was going to only play one mega ball in tonight's drawing which one would give me my best opportunity for a win on every ticket?  Picking the winning megaball means every ticket is free and I would be playing with the lottery's money.

                      The function makes the selection.

                      If you need an Excel file, we will have a generic one later today.

                      Presented 'AS IS' and for Entertainment Purposes Only.
                      Any gain or loss is your responsibility.
                      Use at your own risk.

                      Order is a Subset of Chaos
                      Knowledge is Beyond Belief
                      Wisdom is Not Censored
                      Douglas Paul Smallish
                      Jehocifer

                        JADELottery's avatar - YingYangYong 01.PNG
                        The Quantum Master
                        West Concord, MN
                        United States
                        Member #21
                        December 7, 2001
                        3685 Posts
                        Online
                        Posted: May 22, 2015, 6:11 pm - IP Logged

                        The function makes the selection.

                        If you need an Excel file, we will have a generic one later today.

                        Here is the Disimulate Excel file for Mega Millions and Powerball.

                        http://www.jadexcode.com/files/excel/disimulate-mm-pb-0.xlsm

                        or

                        ftp://www.jadexcode.com/excel/disimulate-mm-pb-0.xlsm

                        good luck.

                        Presented 'AS IS' and for Entertainment Purposes Only.
                        Any gain or loss is your responsibility.
                        Use at your own risk.

                        Order is a Subset of Chaos
                        Knowledge is Beyond Belief
                        Wisdom is Not Censored
                        Douglas Paul Smallish
                        Jehocifer

                          lakerben's avatar - Lottery-061.jpg
                          New Mexico
                          United States
                          Member #86099
                          January 29, 2010
                          11167 Posts
                          Offline
                          Posted: May 22, 2015, 10:26 pm - IP Logged

                          Here is the Disimulate Excel file for Mega Millions and Powerball.

                          http://www.jadexcode.com/files/excel/disimulate-mm-pb-0.xlsm

                          or

                          ftp://www.jadexcode.com/excel/disimulate-mm-pb-0.xlsm

                          good luck.

                          Thanks jade!

                          US Flag

                            MzDuffleBaglady's avatar - Lottery-018.jpg

                            United States
                            Member #81314
                            October 16, 2009
                            19464 Posts
                            Offline
                            Posted: May 22, 2015, 10:40 pm - IP Logged

                            Good Luck.

                            The Struggle is real!

                              JADELottery's avatar - YingYangYong 01.PNG
                              The Quantum Master
                              West Concord, MN
                              United States
                              Member #21
                              December 7, 2001
                              3685 Posts
                              Online
                              Posted: May 26, 2015, 7:48 am - IP Logged

                              No problem.

                              Hope you win big.

                              Presented 'AS IS' and for Entertainment Purposes Only.
                              Any gain or loss is your responsibility.
                              Use at your own risk.

                              Order is a Subset of Chaos
                              Knowledge is Beyond Belief
                              Wisdom is Not Censored
                              Douglas Paul Smallish
                              Jehocifer

                                 
                                Page 1 of 15