A fun little probability puzzle for you.

But only when all previous flips give about a 50 50 distribution.

Can we fucking do the experiment already?

You’re slippin!

WAIT

Oh shit you’re not gonna like this.

Ok, the margin of error has to get smaller the larger the amount of repetitions gets.

Origami, here it is

jsfiddle.net/5gqmykha/

That is what the 50,000 is for. After 50,000 - you will have close to 50/50 (make it 500,000 if you like to wait).
Then watch for the AAAX - save the X - count the X’s for 1000 times or more.

Fine.

Ignore me. Whatever.

If you always call heads. You actually have a chance of always getting heads forever.

If you always call tails. You actually always have a chance of getting tails forever.

If you randomly call heads or tails each time, there is an infinite chance that an infinite number of someone’s will be correct, forever.

So. I ask you this. Are the odds greater or lesser that you’ll be or not be one of these people?

js

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.