A fun little probability puzzle for you.

I don’t see that it actually counts the distribution of all flips before the aaax. It seems to be counting just the previous x’s from previous aaax’s.

that program is aaab not aaax

aaax is xxxx

This is the code that calls the function to calculate the margin

if (isWithinMargin(headsTotal-3, tailsTotal)) {

headsTotal and tailsTotal are not just “previous Xs”, they are the heads and tails of ALL flips.

function flip() { // value will be random number of 0 or 1 const value = getRandomInt(2); addToTotal(value);

“previous Xs” are the variables headsAfter3 and tailsAfter3

Give me a second, C++ works backwards from how C works.

Now let’s really make this a philosophy topic if you’re interested…

What are the odds of existence existing?

If you ever flip a tail, we can’t be here… having this discussion.

Heads forever.

What are the odds?

Greater. Forever.

Like, why isn’t headstotal and tailstoal being altered after every flip in flip()?

You should teach us how to write such programs - get some use out of coming to this board. :wink:

It is, the second thing I do in flip is “addToTotal(value);”, which updates headstotal and tailstotal.

If you want a programming mentor/tutor, I’m potentially interested in that, sure.

But it doesn’t make sense, because look:

If you subtract all aaax’s that the program counts, the remainder is either not 50 50, and so the ab distribution in the aaax’s is not 50 50, or it is 50 50, and aaax will not be 50 50 (on account of at least 3 being always a), and the total distribution will not be 50 50.

I have no clue why you keep bringing up what will happen when you subract all the streaks of heads. Of course the distribution won’t be 50/50 when you subtract the streaks of heads but not the streaks of tails! Why would any reasonable person expect anything different?

That has nothing to do with the claim you made. I don’t see how they’re related.

I don’t know C++ from D-- but it might be interesting to find out — although now I’m thinking about all of the other little efforts I am occupied with. :confused:

Because we programmed the flipper to only count the x’s of aaax’s that occur when the distribution before it was 50 50, effectively subtracting the aaax’s.

Origami, I have some bad news for you, but I have some good news that’s even better than the bad news.

The bad news is, your statistical intuition about what happens after a streak is wrong. Whatever you thought you knew, is wrong.

The good news is, you can be right now. If you allow yourself to learn something right now, you will be smarter than you were before. What’s better than that?

This contradiction doesn’t bother you?

I’m really not seeing any contradiction. You subtract the heads streaks, you’re left with less heads than tails. There’s nothing problematic there for me, intuitively or otherwise. That seems… normal.

Like if you only count the aaax’s that occur after an equal distribution of aaa…

Oh shit I get it. You can’t count instances of aaax in the headsinarow and tailsinarow values.

Otherwise you are not eliminating shit, you are not getting rid of the garbage data.