tag:blogger.com,1999:blog-3760169963830810897.post8296756775850733663..comments2023-03-26T21:00:59.091+01:00Comments on Code Butchering: Heads or Tails? or: how to lose money at the roulette tableAnonymoushttp://www.blogger.com/profile/13431481971279629409noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-3760169963830810897.post-23718999916112664102011-11-10T03:51:44.904+00:002011-11-10T03:51:44.904+00:00@anonymous yes, I could've calculated the prob...@anonymous yes, I could've calculated the probability no problem that way - but what I was really curious about (and could not infer from the probability) was the longest streak of identical outcomes that one may come up with over a huge number of tosses (100 million series was huge enough for my curiosity).Anonymoushttps://www.blogger.com/profile/13431481971279629409noreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-4668987778242420132011-11-05T20:27:10.924+00:002011-11-05T20:27:10.924+00:00Oh, and about the average length: if you compute t...Oh, and about the average length: if you compute the expected value as the infinite sum of n / 2^n for n >= 1, you get 2.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-69300689644314844572011-11-05T20:24:33.526+00:002011-11-05T20:24:33.526+00:00You could have easily computed the probability of ...You could have easily computed the probability of a streak having a specific length n >= 1 as 1/2^n, and so find out that the probability of a streak of length 26, like the one you observed, is 1.49 * 10^-8. Multiplying this probability by the number of trials (10^8), you get that the expected number of streaks of length 26 is 1.49... and you got yours! ;-)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-83457488034501329452011-04-28T14:39:59.938+01:002011-04-28T14:39:59.938+01:00Hi Peter, I ran it a bunch of times (3 or 4) - 100...Hi Peter, I ran it a bunch of times (3 or 4) - 100 million series of tosses each time - and 26 was the longest streak recorded. The average streak was (not surprisingly) 1!Anonymoushttps://www.blogger.com/profile/13431481971279629409noreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-22217144139802334302011-04-28T14:23:41.481+01:002011-04-28T14:23:41.481+01:00How many times did you run it? Was 26 the average ...How many times did you run it? Was 26 the average "streak" or was it the longest? Interesting distraction!Anonymoushttps://www.blogger.com/profile/11516760757467351782noreply@blogger.com