Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92417

Re: Testing random

Newsgroups comp.lang.python
Date 2015-06-10 10:52 -0700
References (7 earlier) <5515034.V7dcXEWAvK@PointedEars.de> <lf5sia3bakh.fsf@ling.helsinki.fi> <1583276.2lplL8rY5W@PointedEars.de> <lf5r3pmejgh.fsf@ling.helsinki.fi> <16299015.icEhCTIHP8@PointedEars.de>
Message-ID <e4a78e74-ca31-4000-9239-e14df9b47fd0@googlegroups.com> (permalink)
Subject Re: Testing random
From sohcahtoa82@gmail.com

Show all headers | View raw


On Wednesday, June 10, 2015 at 10:06:49 AM UTC-7, Thomas 'PointedEars' Lahn wrote:
> Jussi Piitulainen wrote:
> 
> > Thomas 'PointedEars' Lahn writes:
> >> Jussi Piitulainen wrote:
> >>> Thomas 'PointedEars' Lahn writes:
> >>>>   8 3 6 3 1 2 6 8 2 1 6.
> >>> 
> >>> There are more than four hundred thousand ways to get those numbers
> >>> in some order.
> >>> 
> >>> (11! / 2! / 2! / 2! / 3! / 2! = 415800)
> >>
> >> Fallacy.  Order is irrelevant here.
> > 
> > You need to consider every sequence that leads to the observed counts.
> 
> No, you need _not_, because – I repeat – the probability of getting a 
> sequence of length n from a set of 9 numbers whereas the probability of 
> picking a number is evenly distributed, is (1∕9)ⁿ [(1/9)^n, or 1/9 to the 
> nth, for those who do to see it because of lack of Unicode support at their 
> system].  *Always.*  *No matter* which numbers are in it.  *No matter* in 
> which order they are.  AISB, order is *irrelevant* here.  *Completely.*
> 
> This is _not_ a lottery box; you put the ball with the number on it *back 
> into the box* after you have drawn it and before you draw a new one.
> 
> > One of those sequences occurred. You don't know which.
> 
> You do not have to.
> 
> > When tossing herrings […]
> 
> Herrings are the key word here, indeed, and they are deep dark red.
> 
> > Code follows. Incidentally, I'm not feeling smart here. 
> 
> Good.  Because you should not feel smart in any way after ignoring all my 
> explanations.
> 
> > [nonsense]
> 
> -- 
> PointedEars
> 
> Twitter: @PointedEars2
> Please do not cc me. / Bitte keine Kopien per E-Mail.

To put it another way, let's simplify the problem.  You're rolling a pair of dice.  What are the chances that you'll see a pair of 3s?

Look at the list of possible roll combinations:

1 1     1 2     1 3     1 4     1 5     1 6
2 1     2 2     2 3     2 4     2 5     2 6
3 1     3 2     3 3     3 4     3 5     3 6
4 1     4 2     4 3     4 4     4 5     4 6
5 1     5 2     5 3     5 4     5 5     5 6
6 1     6 2     6 3     6 4     6 5     6 6

36 possible combinations.  Only one of them has a pair of 3s.  The answer is 1/36.

What about the chances of seeing 2 1?

Here's where I think you two are having such a huge disagreement.  Does order matter?  It depends what you're pulling random numbers out for.

The odds of seeing 2 1 are also only 1/36.  But if order doesn't matter in your application, then 1 2 is equivalent.  The odds of getting 2 1 OR 1 2 is 2/36, or 1/18.

But whether order matters or not, the chances of getting a pair of threes in two rolls is ALWAYS 1/36.

If this gets expanded to grabbing 10 random numbers between 1 and 9, then the chances of getting a sequence of 10 ones is still only (1/9)^10, *regardless of whether or not order matters*.  There are 9^10 possible sequences, but only *one* of these is all ones.

If order matters, then 7385941745 also has a (1/9)^10 chance of occurring.  Just because it isn't a memorable sequence doesn't give it a higher chance of happening.

If order DOESN'T matter, then 1344557789 would be equivalent, and the odds are higher.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Testing random Cecil Westerhof <Cecil@decebal.nl> - 2015-06-07 08:27 +0200
  Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 12:40 +0200
    Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-07 21:51 +1000
      Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 17:51 +0200
        Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 02:25 +1000
          Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 18:36 +0200
            Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 02:44 +1000
              Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 20:23 +0200
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 04:52 +1000
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 21:41 +0200
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-07 22:08 +0300
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 21:29 +0200
                Re: Testing random random832@fastmail.us - 2015-06-07 15:44 -0400
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:09 +0200
                Re: Testing random random832@fastmail.us - 2015-06-07 16:41 -0400
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:59 +0200
                Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:26 +1000
                Re: Testing random random832@fastmail.us - 2015-06-07 21:34 -0400
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 11:42 +1000
                Re: Testing random MRAB <python@mrabarnett.plus.com> - 2015-06-08 02:49 +0100
                Re: Testing random random832@fastmail.us - 2015-06-07 21:57 -0400
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-08 10:40 +0300
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-10 19:03 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-10 10:52 -0700
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-10 23:00 +0300
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-10 12:02 -0600
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-12 23:32 +0200
                Re: Testing random alister <alister.nospam.ware@ntlworld.com> - 2015-06-12 21:46 +0000
                Re: Testing random random832@fastmail.us - 2015-06-12 17:52 -0400
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-12 16:00 -0600
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-13 00:09 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-12 15:55 -0700
                Re: Testing random random832@fastmail.us - 2015-06-12 18:57 -0400
                Re: Testing random Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-13 08:53 +0100
                Re: Testing random random832@fastmail.us - 2015-06-10 14:26 -0400
                Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-07 14:21 -0700
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-16 21:18 +0200
                Re: Testing random random832@fastmail.us - 2015-06-16 16:23 -0400
                Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-16 13:48 -0700
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-16 23:57 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-16 15:30 -0700
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-16 16:58 -0600
                Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 11:28 +0200
                Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-16 16:26 -0700
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-17 01:45 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-16 17:36 -0700
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-17 11:01 +1000
                Re: Testing random Ethan Furman <ethan@stoneleaf.us> - 2015-06-16 18:32 -0700
                Re: Testing random Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-17 09:41 +0100
                Re: Testing random Grant Edwards <invalid@invalid.invalid> - 2015-06-17 14:04 +0000
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-17 09:01 -0600
                Re: Testing random MRAB <python@mrabarnett.plus.com> - 2015-06-17 01:42 +0100
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-17 08:53 +0200
                Re: Testing random Christian Gollwitzer <auriocus@gmx.de> - 2015-06-17 09:22 +0200
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-17 17:28 +1000
                Re: Testing random Tim Golden <mail@timgolden.me.uk> - 2015-06-17 08:30 +0100
                Re: Testing random Cecil Westerhof <Cecil@decebal.nl> - 2015-06-17 11:57 +0200
                Re: Testing random Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-17 01:36 +0000
                Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 12:33 +0200
                Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-17 22:47 +1000
                Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 15:50 +0200
                Re: Testing random Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-17 01:35 +0000
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-17 07:41 +0300
                Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:11 +1000
            Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-07 11:07 -0600
            Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 03:20 +1000
            Re: Testing random "C.D. Reimer" <chris@cdreimer.com> - 2015-06-07 10:36 -0700
            Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 04:28 +1000
              Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 04:40 +1000
        Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 04:24 +1000
  Re: Testing random Jonas Wielicki <jonas@wielicki.name> - 2015-06-07 12:41 +0200
  Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-07 22:52 +1000
    Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-07 23:06 +1000
    Re: Testing random Peter Otten <__peter__@web.de> - 2015-06-07 15:35 +0200
      Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 18:36 +0200
        Re: Testing random Peter Otten <__peter__@web.de> - 2015-06-07 18:48 +0200
          Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:15 +0200
      Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:35 +1000
  Re: Testing random Christian Gollwitzer <auriocus@gmx.de> - 2015-06-07 14:53 +0200
  Re: Testing random Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-06-07 11:04 -0400

csiph-web