What is the Probability of Flipping Two Strange Coins?

  • Thread starter StrangeCoin
  • Start date
  • Tags
    Strange
In summary: Are you trying to test whether the previous rolls affect the probability of the next roll? If so, the applet provided should work. But as I mentioned before, each roll is an independent event and the probability remains 1/6 regardless of the previous rolls. In summary, the conversation discussed the concept of independence in statistics and probability, and how it applies to rolling dice and flipping coins. The probability of getting two heads or two tails when one coin is set to flip heads 70% of the time and the other to flip heads 20% of the time was calculated to be 38%. It was also mentioned that the previous results of a dice roll do not affect the probability
  • #1
StrangeCoin
58
0
These two coins are strange because the probability between their heads and tails can be adjusted from 0% to 100%. What is the probability of getting two heads or two tails, if for example one coin is set to flip heads 70% and the other to flip heads 20% of the time? Thanks.
 
Physics news on Phys.org
  • #2
Do you know what independence means?
 
  • #3
pwsnafu said:
Do you know what independence means?

Not in terms of statistics and probability. I am only able to figure out the most simple scenarios, I don't know where to even begin with this one.
 
  • #4
Consider a normal six-sided die. The probability to roll a 6 AND then another 6 is ##\frac 1 6\cdot\frac 1 6=\frac{1}{36}##. The probability to roll a 6 OR a 5 is ##\frac 1 6+\frac 1 6=\frac 1 3##. A good rule of thumb is that an "and" means that you need to multiply the probabilities, and an "or" means that you need to add them.

Two events A and B are independent if knowing that one of them occurred doesn't affect the probability that the other one occurred. Suppose that you roll two dice, and see that the first one is a 6. This knowledge doesn't change the probability that the other one is a 6.

My suggestion that you interpret "and" as "multiply the probabilities" is only good when the events are independent.
 
  • #5
Fredrik said:
Consider a normal six-sided die. The probability to roll a 6 AND then another 6 is ##\frac 1 6\cdot\frac 1 6=\frac{1}{36}##. The probability to roll a 6 OR a 5 is ##\frac 1 6+\frac 1 6=\frac 1 3##. A good rule of thumb is that an "and" means that you need to multiply the probabilities, and an "or" means that you need to add them.

Two events A and B are independent if knowing that one of them occurred doesn't affect the probability that the other one occurred. Suppose that you roll two dice, and see that the first one is a 6. This knowledge doesn't change the probability that the other one is a 6.

My suggestion that you interpret "and" as "multiply the probabilities" is only good when the events are independent.

Ok, thanks. Let me try then.

Coin 1 Heads = 70%, Tails = 30%
Coin 2 Heads = 20%, Tails = 80%
---

Chance of H&H = 0.7 * 0.2 = 0.14
Chance of T&T = 0.3 * 0.8 = 0.24

Chance of H&H or T&T = 0.14 + 0.24 = 38%
 
  • #6
Fredrik said:
Suppose that you roll two dice, and see that the first one is a 6. This knowledge doesn't change the probability that the other one is a 6.

But as the number of rolls increases, doesn't it become increasingly unlikely that you would keep rolling the same number?

Getting 6 ten times in a row is less probable than rolling it only 2-3 times, so doesn't that mean that each roll is not really independent but somehow related to its history and past time?
 
  • #7
StrangeCoin said:
But as the number of rolls increases, doesn't it become increasingly unlikely that you would keep rolling the same number?

Getting 6 ten times in a row is less probable than rolling it only 2-3 times, so doesn't that mean that each roll is not really independent but somehow related to its history and past time?

No. The easiest way to see this is to realize that rolling a die twice, is the same thing as rolling two different dice at the same time in two different place around the world. Those two dice can't communicate with each other.

Also 6666666666 has the same probability as 6612345123. The reason why "getting 6 ten times in a row is less probable than rolling it only 2-3 times" is true is because there are more permutations of the latter. Both 6612345123 and 1234512366 have two sixes, but there is only one way to roll 6666666666.
 
  • #8
StrangeCoin said:
Ok, thanks. Let me try then.

Coin 1 Heads = 70%, Tails = 30%
Coin 2 Heads = 20%, Tails = 80%
---

Chance of H&H = 0.7 * 0.2 = 0.14
Chance of T&T = 0.3 * 0.8 = 0.24

Chance of H&H or T&T = 0.14 + 0.24 = 38%
Looks good. Note that the probabilities of the four possible sequences (HH, HT, TH and TT) add up to 1. It's a good idea to do sanity checks like this when you do probability calculations, because it's so easy to make mistakes.
 
  • #9
pwsnafu said:
The reason why "getting 6 ten times in a row is less probable than rolling it only 2-3 times" is true is because there are more permutations of the latter. Both 6612345123 and 1234512366 have two sixes, but there is only one way to roll 6666666666.

Yes, but makes this true as well, it still holds: rolling 6 on 10th try is less likely if previous nine rolls were all 6, than if they were not.
 
Last edited:
  • #10
StrangeCoin said:
Yes, but makes this true as well, it still holds: rolling 6 on 10th try is less likely if previous nine rolls were all 6, than if they were not.
This is incorrect. The probability is 1/6, regardless of what the previous results were.
 
  • #11
Fredrik said:
This is incorrect. The probability is 1/6, regardless of what the previous results were.

I can't disagree with that. I just feel there is more to it. Can we test it? I could write a little dice rolling program, just not sure what exactly to test for, or test against, what to compare and how.
 
  • #12
StrangeCoin said:
I can't disagree with that. I just feel there is more to it. Can we test it? I could write a little dice rolling program, just not sure what exactly to test for, or test against, what to compare and how.

Sure, you can test it. Probability may be part of math, but it has a lot of empirical tests! (maybe probability should be part of physics...)

I think the most convincing way to test it is by actually getting a dice, throwing it 120 times and then recording the score. you will see you will get about 20 times 1, about 20 times 2 and so on.

Or you can use this excellent applet: http://www.math.uah.edu/stat/applets/DiceExperiment.html
 
  • #13
I'm talking about distribution, sequences and streaks, rather than just overall or total statistics. What I'm saying is that if we roll a dice for an eternity we should never roll 6-side 100 times in a row. And if it happens, then it means the rolls were not actually random, because that's completely the opposite of what random is supposed to be. The only thing we know about random is that it is "not in order" (seemingly at least), it must not contradict its own definition.

In other words, for random number generator to qualify as "truly" random it should never be able to produce 100 sixes in a row. Or should it? There is definitively something not quite right with the logic of using arbitrary numbers like "100", and yet by definition there really should be some point of correlation and order, in random sequences and proportional to their length, which "random" must not cross for the sake of not becoming the opposite of what it means.
 
  • #14
Why shouldn't we be able to roll 100 ones in a row? If the dice is truly random, then this should happen sooner or later.

However, the probability that this happens is extremely low. If you roll a dice yourself, it might never happen. But you talked about rolling the dice "for eternity". This is a very different situation.

We can calculate with some very advanced mathematics that in order to get a sequence of ##n## consecutive ones, we need to roll the dice ##\frac{6^{n+1} -6}{5}##.
So in order to roll one only one time, we need to roll the dice approximately 6 times. In order to get a sequence of two consecutive ones, we need to roll the dice approximately 42 times. As you see, this is getting high very quickly!
In order to roll a one a 100 times in a row, we need to roll the dice approximately ##783,982,348,200,085,087,316,028,320,589,669,384,644,572,452,567,545,845,851,686,359,643,396,569,772,850##

This is a staggering number. It is approximately ##7\times 10^{77}##. The scientific name for such a number is ##783## quattuorvigintillion.
In comparison, the current age of the universe is ##4.3\times 10^{17}## seconds. So if we started rolling dice from the start of the universe onwards, we probably haven't seen a sequence of 100 consecutive ones yet. The probability that we have is approximately ##5\times 10^{-61}##, which is for all intents and purposes so close to to 0 that we can always take it equal to 0.

But then again, you talked about tossing dice forever. Then the power of infinity comes into play. Throwing a dice ##7\times 10^{77}## times is pretty trivial in the face of infinity. So if we truly could toss forever, or at least a sufficiently high number of times, then we will get a sequence of 100 heads.

Compare it with this. Let's say you throw a dice a very high number of times (like one billion times). Do you expect to see 2 consecutive ones? Of course you do. Do you expect to see 3 consecutive ones? Sure, but less times. Do you expect to see 4 consecutive ones? Of course, but even less.
So where is the boundary where you do expect to see ##n## consecutive heads, but suddenly ##n+1## is totally impossible and indicates the dice is loaded? There shouldn't be such a boundary. All rolls of consecutive heads should be possible, but not all should be likely.

For people interested in the math of the above astronomical numbers:
https://courses.cit.cornell.edu/info2950_2012sp/mh.pdf
http://www.askamathematician.com/20...pproximations-when-the-exact-answer-is-known/
 
  • #15
StrangeCoin said:
we should never roll 6-side 100 times in a row

People who study science and mathematics want to know facts and facts are traditionally given in terms of absolute guarantees. However, if the topic of study is probability (or any other measure of "uncertainty") then there is a fundamental problem; how can we make guarantees about something that is uncertain? The way this is handled in probability theory is that the theorems take the form: If the probability of one thing is such-and-such then the probability of another thing is so-and-so.

If you believe a statement of the form: If the probabiility of one thing is such-and-such then this other thing is guaranteed to happen (or guranateed not to happen), you may be dealing with a self-contradictory idea. As others have pointed out, the idea that each roll of a die is an independent probabilistic event contradicts any attempt to give absolute guarantees about the results of how it actually lands.
 
  • #16
StrangeCoin said:
I'm talking about distribution, sequences and streaks, rather than just overall or total statistics. What I'm saying is that if we roll a dice for an eternity we should never roll 6-side 100 times in a row. And if it happens, then it means the rolls were not actually random, because that's completely the opposite of what random is supposed to be.
This is wrong. Let's denote the two sides of a coin by 0 and 1. If you flip a coin 10 times, it's likely (more than 50%) that the sequence of results will contain the subsequence 111. If you flip it 100 times, it's likely that the sequence will contain the subsequence 11111. (I haven't actually calculated those probabilities, so I'm not sure if that the length of the subsequence should be 5, but you get the idea). Think of any subsequence, of any length (for example "a million 1s"). There's always a number N such that if you flip the coin N times, it's likely that your subsequence will appear.

What would be the alternative to this? That you can only get the sequences 010101... or 101010...? That wouldn't be random at all.

The experiment with 100 flips is doable, so you may want to try it.
 
  • #17
micromass said:
In order to roll a one a 100 times in a row, we need to roll the dice approximately ##783,982,348,200,085,087,316,028,320,589,669,384,644,572,452,567,545,845,851,686,359,643,396,569,772,850##

This is a staggering number. It is approximately ##7\times 10^{77}##. The scientific name for such a number is ##783## quattuorvigintillion.

Yikes! And there is even a word for it. I'll rename my cat to that.


So where is the boundary where you do expect to see ##n## consecutive heads, but suddenly ##n+1## is totally impossible and indicates the dice is loaded? There shouldn't be such a boundary. All rolls of consecutive heads should be possible, but not all should be likely.

I agree. The differences kind of arise due to semantics. You are willing to call a streak of sixes "random" no matter of the streak size compared to the size of the sequence, and I'm not.

Consider if the universe started rolling sixes from the beginning of time, every second another roll and every time it's a six, and so on to this day and into the eternal future. You would say that's just as likely as any other combination of the 6 possibilities, and I'm saying it doesn't even apply, it does not compute because such sequence is not random to start with, it's the opposite. It's a sort of singularity that defines "impossible", if it ever happens the universe would instantly disappear and be replaced by something more bizarre and inexplicable.
 
  • #18
StrangeCoin said:
Consider if the universe started rolling sixes from the beginning of time, every second another roll and every time it's a six, and so on to this day and into the eternal future. You would say that's just as likely as any other combination of the 6 possibilities, and I'm saying it doesn't even apply, it does not compute because such sequence is not random to start with, it's the opposite.
I get the impression that you've been confusing two rather different problems. One is the problem of rolling a die multiple times. The other is the weird situation that you've been sent a die from the factory and then been told that half the dice they sent out were defective and always stop on 6. In this problem, each 6 you roll makes it more likely that you are in fact rolling the defective die. But in the other problem, the die is by assumption not defective.
 
  • #19
Fredrik said:
I get the impression that you've been confusing two rather different problems. One is the problem of rolling a die multiple times. The other is the weird situation that you've been sent a die from the factory and then been told that half the dice they sent out were defective and always stop on 6. In this problem, each 6 you roll makes it more likely that you are in fact rolling the defective die. But in the other problem, the die is by assumption not defective.

Exactly. I am indeed suggesting it's one and the same problem, kind of circular reasoning and self-referencing contradiction. When 2+2 stops being equal to 4 is the same moment random becomes "perfect order" and pigs start to fly. It's impossible by definition, it's like dividing by zero.

In essence I'm saying there is a difference between "mathematical random" and "natural random", theoretical and practical. The first one includes every and all possibilities, but the second one has limits and rules. The rules guided, or manifestation of, the same laws that make the universe aggregate into complexity rather than dissipate into white noise or separate into "black" and "white".

If we don't roll six after 6 tries, every roll after that simply must become more and more likely to yield a six, that's what we observe happens in reality. There must be some defined point where probability of getting non-random sequence occurring in a random sequence is equal to "impossible". This is the point where "random sequence" changes its name to "non-random sequence", the point where "natural" becomes "artificial".
 
Last edited:
  • #20
StrangeCoin said:
In order to get a sequence of two consecutive sixes we need to roll the dice approximately 42 times. If we don't get two sixes after 42 rolls, every roll after that simply must become more and more likely to yield a six as that's what we observe happens in reality.

No! We do not observe this in reality! This is called the gambler's fallacy and is confusing to so many people trying to deal with probability. The chances of getting a six never increase. Not in the mathematical theory as in the observations!

If I say that the expected number of times we need to roll the dice to get two consecutive sixes is 42. Then I mean with that something very specific. It means that I do the following experiment: I take the dice, and I roll it until I have two consecutive sixes. Then I record the number of throws.

If I do this experiment one time, then there is nothing I can say. Probability only emerges if you do something a lot of times.

What does the 42 throws mean then? It means that if I do the experiment a lot of times (say 100 times) and if I record the number of throws each time, then the average of these numbers will be 42. This means that sometimes I will get two sixes almost immediately after say 4 rolls. And sometimes I will need 100 rolls.

Probability is something that gives meaningless statements if I only do the experiment once. Everything can happen, and I do not know what it will be. Probability will be important if I repeat the experiment enough times. This is why in testing new drugs, we administer the drugs to a rather large number of people (usually around 30). If we only were to test the drugs on 1 person, then we could deduce nothing.

Also, you seem to think there is a difference between "mathematical random" and "natural random". There is no difference. Mathematical probability works perfectly with respect to the natural random. The agreement between the mathematical results and the experiments is perfect. It is one of the most successful theories we have. It works even better than physics theories like classical mechanics which is seen to be "wrong" on certain scales. This is why probability is likely a part of math and not of physics.

I understand the issues you have with random numbers. You have some preconceptions in your head that do not match reality. I don't blame you since the human mind really has a very bad intuition of "random". Why do you think that the computer is so much better in Rock-Paper-Scissors than you? Because a computer is much better in generating random data, a human is not. A human will pick patterns like "oh, I didn't do stone in a while, so I must do that". This kind of reasoning breaks the randomness. A computer knows that and uses it to win against you. See http://www.nytimes.com/interactive/science/rock-paper-scissors.html?_r=0

I have said that the mathematics describes the randomness in nature perfectly. But please, do not take my word for it. Test it yourself! Do a version of the experiment above: "Throw a dice until you have a six. Record the number of throws you needed to do before you got 6".
Do the experiment 50 or 100 times and record the scores. You will see that the different outcomes are widely different. This illustrates the fact that you cannot say anything meaningful about the different individual experiments. But you can say something about the whole! Indeed, take the average of the scores you got and you will see that you got very close to 6.

Then, if you're good with programming. Do the above experiment but only record the number of throws until you got 5 consecutive sixes. Then do this experiment 1000 times with the computer. Look at the different outcomes, they will look very different, but the average should lie around 9330.

Please, do these experiments! And also please read this: http://en.wikipedia.org/wiki/Gambler's_fallacy
 
  • #21
micromass said:
No! We do not observe this in reality! This is called the gambler's fallacy and is confusing to so many people trying to deal with probability. The chances of getting a six never increase. Not in the mathematical theory as in the observations!

I think you are basically saying anything and everything is possible given enough time, for you there is no "impossible", but instead you have "highly unlikely". On the other hand I'm saying some things are just downright clear cut impossible, like 100% impossible, in this universe as it is.


What does the 42 throws mean then? It means that if I do the experiment a lot of times (say 100 times) and if I record the number of throws each time, then the average of these numbers will be 42. This means that sometimes I will get two sixes almost immediately after say 4 rolls. And sometimes I will need 100 rolls.

I'm not disagreeing with you. I'm just saying that if you ever really don't get a single 6 in 100 rolls it would be very unnatural, and just as likely to cause the universe to disappear and be replaced by something else.


I have said that the mathematics describes the randomness in nature perfectly. But please, do not take my word for it. Test it yourself! Do a version of the experiment above: "Throw a dice until you have a six. Record the number of throws you needed to do before you got 6".
Do the experiment 50 or 100 times and record the scores. You will see that the different outcomes are widely different. This illustrates the fact that you cannot say anything meaningful about the different individual experiments. But you can say something about the whole! Indeed, take the average of the scores you got and you will see that you got very close to 6.

The problem is I can prove my claim, but you can not prove yours. I can say you will never roll a dice 100 times without getting a single six. If you attempt you will most likely, if not certainly, be wasting time proving my claim instead. The question is only how low I can go, where is it that 'highly unlikely' becomes 'truly impossible'. Maybe 30 rolls without a single six is already 100% impossible. Without practically confirming otherwise you can't really be sure. An infinite sequence where it never happens is just as probable as a sequence where it does happen, that's what you're saying, right? So you must let it be a possibility too, just like the rest.


Then, if you're good with programming. Do the above experiment but only record the number of throws until you got 5 consecutive sixes. Then do this experiment 1000 times with the computer. Look at the different outcomes, they will look very different, but the average should lie around 9330.

I don't think 5 in a row is enough. To reach "impossible" I suspect we need at least 30 of a kind in a row, or 30 rolls without getting some number at all. I don't think we can really test this, without infinity we don't have enough time to afford waiting for your theory to ever be proven correct, and if we ever succeed in this unnatural act, we risk splitting the whole universe apart into just black and white.
 
Last edited:
  • #22
StrangeCoin said:
I think you are basically saying anything and everything is possible given enough time, for you there is no "impossible", but instead you have "highly unlikely". On the other hand I'm saying some things are just downright clear cut impossible, like 100% impossible, in this universe as it is.

No, that's not what I'm saying at all. Some things are impossible. For example, exceeding the speed of light is impossible. The things I say are possible but highly unlikely are very specific things, and I give a very specific description of them. For example, throwing 100 consecutive sixes in a row is highly unlikely, but not impossible.

I'm not disagreeing with you. I'm just saying that if you ever really don't get a single 6 in 100 rolls it would be very unnatural, and just as likely to cause the universe to disappear and be replaced by something else.

Not at all. The probability is approximately ##10^{-8}## which is low, but not that low. If you write a program that does this and run it long enough (for a billion rolls or so), then you will find some sequence of 100 rolls that does not get a single 6. Don't believe me? Try it.

The problem is I can prove my claim, but you can not prove yours. I can say you will never roll a dice 100 times without getting a single six. If you attempt you will most likely, if not certainly, be wasting time proving my claim instead. The question is only how low I can go, where is it that 'highly unlikely' becomes 'truly impossible'. Maybe 30 rolls without a single six is already 100% impossible. Without practically confirming otherwise you can't really be sure, so you must let it be a possibility too.

No, you can't prove your claim. You can't prove a negative. The only place where you can prove a negative is in mathematics, and mathematics disagrees with you.

It is correct that I cannot prove my claim. However, I can prove many very close-related claims and I can quantify them! And I have a mathematical theory that works. The only logical conclusion is that my claim is correct. It is a leap of faith, sure, but not a big one.

I don't think 5 in a row is enough. To reach "impossible" I suspect we need at least 30 of a kind in a row, or 30 rolls without getting some number at all.

See, where your claim fails is that you have no way to determine this number. Sure, you claim that you can't do a 100 rolls with only sixes. You suspect that 30 rolls also works. But what number of rolls is the smallest that works? 30? 20? You have no way of determining that. As long as you cannot quantify your theory like this, you merely have a guess.
 
  • #23
Alright, I just did the experiment. I programmed a computer to generate dice-rolls (in reality, it generates only 0 and 1, but it generates 1 with a probability 5/6, and 0 with a probability 1/6 so it is the same).

Then I let the computer do dice roll after dice roll. I asked the computer to stop after he had a consecutive sequence of 100 1's (which is equivalent to a consecutive sequence of 100 non-sixes with a standard dice).

The computer ran for quite a long time, 10 or 20 minutes. Finally, it did tell me that there has been a consecutive sequence of 100 1's. The computer also told me that it took ##21,580,227## dice rolls for such a sequence to arise.

If you want to play with this yourself, here is the code:

Code:
#lang racket
(require math)

(define distr (discrete-dist '(0 1) '(1 5)))

(define (random-dice-roll)
  (car (sample distr 1)))
  
(define (Experiment n)
  (define (iter counter number_throws)
    (define d (random-dice-roll))
    (cond [(= counter n) (fprintf (current-output-port) "~a" number_throws)]
          [(= d 1) (iter (+ counter 1) (+ number_throws 1))]
          [(= d 0) (iter 0 (+ number_throws 1))]))
  (iter 0 0))

(Experiment 100)

A program that runs this code can be found in http://download.racket-lang.org/
 
  • #24
micromass said:
The computer ran for quite a long time, 10 or 20 minutes. Finally, it did tell me that there has been a consecutive sequence of 100 1's. The computer also told me that it took ##21,580,227## dice rolls for such a sequence to arise.

Sorcery! I shell perform the experiment myself, I must know, so here I go...
 
  • #25
I have modified the code such that it saves all the dice rolls to a (possibly huge) file.

Code:
#lang racket
(require math)

(define distr (discrete-dist '(1 2 3 4 5 6) '(1 1 1 1 1 1)))

(define (random-dice-roll)
  (car (sample distr 1)))

(define MyPort (open-output-file "test.txt" #:exists 'append))
  
(define (Experiment n)
  (define (iter counter number_throws)
    (define d (random-dice-roll))
    (fprintf MyPort "~a " d)
    (cond [(= counter n) (fprintf (current-output-port) "~a" number_throws)]
          [(not (= d 6)) (iter (+ counter 1) (+ number_throws 1))]
          [else (iter 0 (+ number_throws 1))]))
  (iter 0 0))

(Experiment 100)

(close-output-port MyPort)

To find where the file is located, the code (current-directory) works.

I am running it now, I will upload the file when it's done.
 
  • #26
micromass said:
I have modified the code such that it saves all the dice rolls to a (possibly huge) file.

I wouldn't slow it down with that. Anyway, there must be something wrong with either your program or RNG function. This is what I get:

Code:
6: ++Longest streak= 2
34: ++Longest streak= 3
45: ++Longest streak= 4
1,989: ++Longest streak= 5
6,603: ++Longest streak= 6
7,061: ++Longest streak= 7
542,606: ++Longest streak= 8
3,719,614: ++Longest streak= 9
25,282,514: ++Longest streak= 10
25,282,515: ++Longest streak= 11
100,800,688: ++Longest streak= 12
203,506,206: ++Longest streak= 13
4,294,967,295: DONE!

My function can pick any of the six numbers at random and then it compares that current roll with the previous roll. If they are the same I increase "cur_streak" counter, and then if "cur_streak" is greater than "max_streak" counter, the "max_streak" gets the value of "cur_streak and the information is printed as shown above. Any streak is valid, sixes, fives, fours, threes, twos and ones, just the same.

It goes pretty "quickly" to 10-11 streak, then it takes some time to reach 12-13, and after that it just stays there, for like, ever. You can see the curve bends pretty sharply, it obviously converges towards infinity, to "infinitely unlikely" or "impossible". I bet it wouldn't go over 15 streaks if I leave it to run for weeks, or never even.

I think you would actually have a better luck with some more "natural" source of randomness than computer RNG algorithms, which by design might be doomed to never produce more than, say 15 in a row streaks.
 
Last edited:
  • #27
StrangeCoin said:
I wouldn't slow it down with that. Anyway, there must be something wrong with either your program or RNG function. This is what I get:

Code:
6: ++Longest streak= 2
34: ++Longest streak= 3
45: ++Longest streak= 4
1,989: ++Longest streak= 5
6,603: ++Longest streak= 6
7,061: ++Longest streak= 7
542,606: ++Longest streak= 8
3,719,614: ++Longest streak= 9
25,282,514: ++Longest streak= 10
25,282,515: ++Longest streak= 11
100,800,688: ++Longest streak= 12
203,506,206: ++Longest streak= 13
4,294,967,295: DONE!

My function can pick any of the six numbers at random and then it compares that current roll with the previous roll. If they are the same I increase "cur_streak" counter, and then if "cur_streak" is greater than "max_streak" counter, the "max_streak" gets the value of "cur_streak and the information is printed as shown above. Any streak is valid, sixes, fives, fours, threes, twos and ones, just the same.

It goes pretty "quickly" to 10-11 streak, then it takes some time to reach 12-13, and after that it just stays there, for like, ever. You can see the curve bends pretty sharply, it's obviously converging toward infinity, to "infinitely unlikely" or "impossible". I bet it wouldn't go over 15 streaks even I leave it to run for weeks, and possible never.

I think you would actually have a better luck with some more "natural" source of randomness than computer RNG algorithms, which by design might be doomed to never produce more than, say 15 streaks.

What you did is see the longest streak of consecutive sixes. What I did was the longest streak of numbers which are not six. So 1 4 3 2 1 5 3 would be a streak of length 7.

About your code, it's too bad you accepted straks of 6's and streaks of 5's and so on. This makes it more difficult to check with the theory. But let's compare with the formula for streaks of 6's only, these values will be lower than yours. If you toss the dice ##n## times, then the expected longest streak is given by ##\textrm{log}_6(5n/6)##.

Code:
6: ++Longest streak= 2    Longest streak predicted by theory: 1
34: ++Longest streak= 3    Longest streak predicted by theory: 2
45: ++Longest streak= 4    Longest streak predicted by theory: 2
1,989: ++Longest streak= 5    Longest streak predicted by theory: 4
6,603: ++Longest streak= 6    Longest streak predicted by theory: 5
7,061: ++Longest streak= 7    Longest streak predicted by theory: 6
542,606: ++Longest streak= 8    Longest streak predicted by theory: 7
3,719,614: ++Longest streak= 9    Longest streak predicted by theory: 8
25,282,514: ++Longest streak= 10    Longest streak predicted by theory: 9
25,282,515: ++Longest streak= 11    Longest streak predicted by theory: 9
100,800,688: ++Longest streak= 12    Longest streak predicted by theory: 10
203,506,206: ++Longest streak= 13    Longest streak predicted by theory: 10
4,294,967,295: DONE!    Longest streak predicted by theory: 12

You see how amazingly well the theory predictions agree with your experimental values? They give amazingly good lower bounds. Sure, it's only a lower bound since it's always one or two below your value. But that's because you counted streaks of 4's and 5's too and I'm not feeling for developing the theory for that to find a better prediction.

But let's see. What if you want a streak of 14, how much trials should you let your computer do? The theory says to run it for 15,672,832,819 iterations, which is three times as long as you have done know. What about a streak of 15? You should run it for 94,036,996,915 which is about 19 times as long as you have done now.

What if you want to get over 15, which you say is impossible? The theory says to let it run 564,221,981,491 iterations which is about 100 times as long as you done now. So if you have the memory and the time, please let it run for a couple of days, you will go over 15!

So since there is a reasonable agreement between your table and my theoretical values, why do you expect this agreement to break down eventually? It makes no sense.

Also, random generated numbers are not designed to never produce 15 consecutive numbers.

Reference: http://mathworld.wolfram.com/Run.html
 
Last edited:
  • #28
micromass said:
But let's see. What if you want a streak of 14, how much trials should you let your computer do? The theory says to run it for 15,672,832,819 iterations, which is three times as long as you have done know. What about a streak of 15? You should run it for 94,036,996,915 which is about 19 times as long as you have done now.

I've already tested for well over 15,672,832,819 rolls, by repeating the test. It never went above 13 in a row streak. I will upgrade roll counter from unsigned long to unsigned long long so I can run up to 18,446,744,073,709,551,615 rolls in one go.


Also, random generated numbers are not designed to never produce 15 consecutive numbers.

I didn't mean on purpose, but I wouldn't be surprised some algorithms do try to minimize long streaks in order to make it look more like "white nose" distribution, going everywhere rather than following any trends.


So since there is a reasonable agreement between your table and my theoretical values, why do you expect this agreement to break down eventually? It makes no sense.

Just a feeling.


What if you want to get over 15, which you say is impossible? The theory says to let it run 564,221,981,491 iterations which is about 100 times as long as you done now. So if you have the memory and the time, please let it run for a couple of days, you will go over 15!

Sounds like a bet, I accept! In the meantime here is more detailed info with 4 billion rolls, it shows repeated maximum streaks until a higher streak is achieved:

Code:
3: ++Longest streak= 2
22: ++Longest streak= 2
26: ++Longest streak= 2
27: ++Longest streak= 3
63: ++Longest streak= 3
88: ++Longest streak= 3
135: ++Longest streak= 3
170: ++Longest streak= 3
190: ++Longest streak= 3
333: ++Longest streak= 3
348: ++Longest streak= 3
375: ++Longest streak= 3
463: ++Longest streak= 3
471: ++Longest streak= 3
514: ++Longest streak= 3
530: ++Longest streak= 3
531: ++Longest streak= 4
626: ++Longest streak= 4
713: ++Longest streak= 4
754: ++Longest streak= 4
755: ++Longest streak= 5
756: ++Longest streak= 6
757: ++Longest streak= 7
758: ++Longest streak= 8
266,742: ++Longest streak= 8
266,743: ++Longest streak= 9
266,744: ++Longest streak= 10
13,849,721: ++Longest streak= 10
60,694,700: ++Longest streak= 10
60,694,701: ++Longest streak= 11
90,048,622: ++Longest streak= 11
126,461,427: ++Longest streak= 11
128,375,177: ++Longest streak= 11
128,375,178: ++Longest streak= 12
662,680,498: ++Longest streak= 12
1,395,635,122: ++Longest streak= 12
1,547,176,046: ++Longest streak= 12
1,738,987,914: ++Longest streak= 12
1,769,359,311: ++Longest streak= 12
1,907,939,721: ++Longest streak= 12
2,010,645,238: ++Longest streak= 12
2,010,645,239: ++Longest streak= 13
4,158,128,887: ++Longest streak= 13
4,294,967,295: DONE!
 
  • #29
StrangeCoin said:
I've already tested for well over 15,672,832,819 rolls, by repeating the test. It never went above 13 in a row streak. I will upgrade roll counter from unsigned long to unsigned long long so I can run up to 18,446,744,073,709,551,615 rolls in one go.

If you go up to 18,446,744,073,709,551,615 you can expect a streak of 25.

Just a feeling.

OK, but then the discussion is over. I told you about the theory. I showed you some results how the theory matched with the results, both my results and your results. If you're going to discard this based on a feeling, then all my efforts are useless anyway. I can spend my time better elsewhere.
 
  • #30
micromass said:
OK, but then the discussion is over. I told you about the theory. I showed you some results how the theory matched with the results, both my results and your results. If you're going to discard this based on a feeling, then all my efforts are useless anyway. I can spend my time better elsewhere.

I'm not discarding anything. I said I don't disagree with your theory, it just doesn't invalidate the other possibilities, only practical experiments can do that.

Are you not interested in actual results anymore? It would be nice if you could test it as well since it takes a long time. In any case here's the program I'm running with Windows XP & MinGW, but it should compile on any OS with any C/C++ compiler:

Code:
#include <time.h>
#include <stdio.h>
void printfcomma (unsigned long long n) {
    if (n < 1000) {
        printf ("%llu", n);
        return;
    }
    printfcomma (n/1000);
    printf (",%03llu", n%1000);
}

void main()
{
    system("cls");
    srand(time(NULL));

    int cur_streak= 1;
    int max_streak= 1;
    int last, dice;
    unsigned long long rolls= 0;

    do
    {
        dice= rand()%6;
        if(dice == last)
        {
            cur_streak++;
            if(cur_streak > max_streak)
            {
                max_streak = cur_streak;

                printfcomma(rolls);
                printf(": ++Lucky Streak = %d \n", max_streak);
            }
        }
        else
            cur_streak= 1;

        rolls++;
        last= dice;

    }while(rolls < 94036996915); // 94,036,996,915 testing now, 564,221,981,491 later

    printfcomma(rolls);
    printf(": DONE!\n");
}
 
  • #31
StrangeCoin said:
I'm not discarding anything. I said I don't disagree with your theory, it just doesn't invalidate the other possibilities, only practical experiments can do that.

No, since the theory actually proves the results beyond the shadow of a doubt. If you would study the theory, then you would see actual rigorous proofs of the results.

Besides, what other possibilities? You have the theory of mathematical probability which is so immensely successful that it is used everywhere and gives perfectly accurately results every single time and which all serious scientists accept as true. What other theory is there? You have only presented vague things like "the feeling that we can't get more than 100 sixes in a row". That is not a theory, you can't build on it, you can't deduce other things from it, you can't falsify it, you can't use it to make other predictions, you can't use it in applications, etc.
The mathematical theory of probability is something you can build on, something you can deduce many other things from, something you can falsify, something you can use to make predictions, something that is used in applications. There is no other theory about these matters that does this!
 
  • #32
StrangeCoin said:
I'm not discarding anything. I said I don't disagree with your theory, it just doesn't invalidate the other possibilities, only practical experiments can do that.

Sometimes a theory can be counter-intuitive. And indeed, there are aspects of probability theory that are counter-intuitive when you first meet them. This is often why many people fall victim to things such as the Gambler's fallacy ("oh, I'm doing poorly now, my luck must change for the better soon!"). Which is actually, it seems, the exactly fallacy that you are falling victim to. (You can see this article for a summary of this fallacy: http://en.wikipedia.org/wiki/Gambler's_fallacy)

Sometimes, we have to just take the hard evidence into consideration and accept a theory even if it's counter-intuitive. You ask for practical experiments. Well, practical experiments in probability theory are being carried out every single day and every day probability theory is being validated. ALL casinos in this world operate on this theory. If this theory were fundamentally flawed, then casinos could not be successful. In addition, all of quantum mechanics operates based on probability theory. Again, if probability theory were fundamentally flawed, quantum mechanics would be fundamentally flawed. But we know from experience that casinos make money, and quantum mechanics gives you the right physical answers. So this gives us good indication that we should accept this theory to be true.

If your contention is that a DIFFERENT theory will gives us ALL the same results, then it is your duty to produce this theory, as nobody has yet found one. You cannot expect us, who are all content with the current theory, to try to find a whole new set of laws that obey YOUR intuitions and still reproduce all the successes of probability theory. Indeed, no such theory is possible, because it can be shown that your intuition on this matter leads to incorrect conclusions. Conclusions such as "no string of 15 or more of the same number will ever appear" are patently false.

Having said that, building one's intuition is not without benefit. So, I suggest that instead of holding on to your intuitions so tightly, you should try to see things with an open mind.

Let me ask you a question. If I roll a dice, and it's a unweighted dice so it has no biases, and one day I rolled 8 6's in a row and I hold on to this dice in my hand, it seems to me that you think this dice will be somehow UNLIKELY to roll another 6, is that correct?

Now, what happens if I give this dice to you to roll? Do you think that YOU are unlikely to roll a 6? In other words, do you believe this property of "being unlikely to roll a 6 next" is carried with the dice, or with the roller?

What if I never rolled this dice for a year. In the interim, I roll many other dice, but never this one. The next time I roll this dice, do you think I STILL have a less than 1/6 chance of rolling a 6?

What happens if I never roll a dice for a year. Are my chances of a next dice roll affected by what I did a year ago?

Why might this be different if I waited just a second before my next roll?

What do you think?
 
  • #33
micromass said:
No, since the theory actually proves the results beyond the shadow of a doubt.

Speaking of results, they are finally in for 94,036,996,915 rolls. It took a while.
Code:
4: ++Lucky Streak = 2
10: ++Lucky Streak = 3
118: ++Lucky Streak = 4
502: ++Lucky Streak = 5
2,001: ++Lucky Streak = 6
61,246: ++Lucky Streak = 7
563,660: ++Lucky Streak = 8
563,661: ++Lucky Streak = 9
563,662: ++Lucky Streak = 10
128,971,519: ++Lucky Streak = 11
171,349,947: ++Lucky Streak = 12
443,007,272: ++Lucky Streak = 13
94,036,996,915: DONE!

You said 94,036,996,915 rolls were supposed to produce 15 in a row streak, but 13-streak is still the longest I've seen so far. That number of rolls was actually supposed to produce more than few 14-streaks, but it didn't. Will you please run the test and see if you can get 14 in a row on your computer?
 
  • #34
StrangeCoin said:
You said 94,036,996,915 rolls were supposed to produce 15 in a row streak, but 13-streak is still the longest I've seen so far.

How many 13-streaks did you see? Do you have any information on that?
 
  • #35
Also, I don't know if you can just continue running the program or need to run the program again. But if you run it again, I would be happy if you can save some information for me.

So basically, can you write and run a program (I would do it myself, but your program is apparently much more efficient) that throws a dice a number times and where he records

1) The number of ##1##, ##2##, ##3##, ...
2) The number of streaks of length ##2## formed with ##1## (I do not count 111 as a streak of length ##2##), the number of streaks of length ##2## formed with ##2##, ...
3) The number of streaks of length ##n## (take ##n<20## to be sure) formed with ##1##, ...

Then please run your code for a time of ##100,000,000,000## iterations, and please show all of the above information when you hit the following for the first time: 1000 iterations, 10,000 iterations, 100,000 iterations, etc. I would also appreciate it if you would display all the information whenever a streak of a certain length is first formed, for example, the first time you see a streak of 5.
 

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
29
Views
3K
  • Set Theory, Logic, Probability, Statistics
2
Replies
57
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
20
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
1K
  • Set Theory, Logic, Probability, Statistics
4
Replies
126
Views
6K
  • Set Theory, Logic, Probability, Statistics
2
Replies
45
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
47
Views
6K
Back
Top