• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Moderated Coin Flipper

Leumas

Banned
Joined
Jul 8, 2011
Messages
8,588
.... A single coin toss produces an unpredictable result. But we can predict the approximate results of ten thousand coin tosses. Now, is this random?


The above post led me to write a little WebApp to play with to see the result of coin tosses varying from 10 at a time to 10,000,000 at a time

So you can set the number of coin tosses you would like to see the results for and then tell the app to flip the coin that many times.... it will give you a table of the % of heads and tails for each round you go... and also a running average for the rounds.

Use it to see how even if you go up to 10,000,000 tosses you still are not going to get a precise 50% and even the running average still is not 50%.

If you try 10,000,000 it might take some time depending on the computer you are using... on a good computer should not take more than 0.5 secs for each try... on my computer takes much less and it is a 5 years old computer.... on my iPhone 6plus it takes fraction of a second and on my iPad6 it takes much less than a second.
 
The main point isn't the overall percentage it is that you can't predict what the next flip will be, regardless of your knowledge of the previous flips. With evolution however the past state does affect any future change caused by a "random" mutation or one of the other non-random ways organisms change between generations. And I use the word random in quotes because it is a constrained possibility of where a mutation happens and what it is and if it persists to the next generation.
 
The main point isn't the overall percentage it is that you can't predict what the next flip will be, regardless of your knowledge of the previous flips. With evolution however the past state does affect any future change caused by a "random" mutation or one of the other non-random ways organisms change between generations. And I use the word random in quotes because it is a constrained possibility of where a mutation happens and what it is and if it persists to the next generation.


But constrained-random is still random... just constrained... just like a draw of a card is not going to give a tomato it is constrained by the fact that I had to draw from 52 cards of a certain type not all available cards and fruits.

And when I am playing Poker... what cards I discard and how many cards I request is constrained by what cards I already have... but I am still drawing random cards from a constrained deck which has already lost some of its cards so it is constrained even further.

So evolution is more like a game of poker than a game of war???

But it is all random ... constrained by the details... but still random.

Evolution is
Constrained random mutations punctuated by environmental constraints
 
Last edited:
I tried 100 goes at 10,000,000 flips a go and the running averages were

Running Average H = 50.0009%
Running Average T = 49.9991%

At first glance that looks like pretty darned close to 50-50... no?

But it actually means that out of a 1 billion coin tosses there were still 9,000 more Heads than there were tails.

Now one might think that this will asymptoticly keep getting lesser and finally reach 50-50... but of course not... the next billion flips might shift the balance and have 5000 more tails than heads... and the next billion might make it go 50-50 but the next billion will shift it again and so on and on.

Why??? Because its is random... that is what random means.

I did another additional 50 goes at 10,000,000 flips and now the running averages are... notice the flip in imbalance 4000 more tails than heads

150 goes @ 10,000,000 flips
Running Average H = 49.9996%
Running Average T = 50.0004%


Here are other tries

220 goes @ 1000 flips
Running Average H = 50.0650%
Running Average T = 49.9350%

22 goes @ 10,000 flips
Running Average H = 49.9659%
Running Average T = 50.0341%
 
I may have mentioned it in the past, but I saw a great demonstration of the same idea here back at the 1964 World's Fair. IBM had a demonstration in which there was a vertical tree of pins, on which steel balls were dropped. Precisely made, each drop of each ball was essentially indeterminate, with a 50/50 chance of which way it would drop. A number of balls were dropped before recycling, and though each individual ball was indeterminate all the way down, the pile at the bottom was always a poisson distribution following, within a very small margin, a graph drawn beforehand. There was always a little variation, but it was always within the boundaries.
 
I may have mentioned it in the past, but I saw a great demonstration of the same idea here back at the 1964 World's Fair. IBM had a demonstration in which there was a vertical tree of pins, on which steel balls were dropped. Precisely made, each drop of each ball was essentially indeterminate, with a 50/50 chance of which way it would drop. A number of balls were dropped before recycling, and though each individual ball was indeterminate all the way down, the pile at the bottom was always a poisson distribution following, within a very small margin, a graph drawn beforehand. There was always a little variation, but it was always within the boundaries.


Galton Board... I linked to it on multiple threads on multiple occasions.

 
Last edited:
Galton Board... I linked to it on multiple threads on multiple occasions.

Yes, that's the one. I guess I missed your instances of it. The IBM one was very fancy and neatly made, automated to repeat endlessly, and (obviously) made a lasting impression when I was a kid. I think it had rather more balls than the demo one you show, thus resulting in a less erratic distribution, but the principle is of course the same.
 
Yes, that's the one. I guess I missed your instances of it. The IBM one was very fancy and neatly made, automated to repeat endlessly, and (obviously) made a lasting impression when I was a kid. I think it had rather more balls than the demo one you show, thus resulting in a less erratic distribution, but the principle is of course the same.


It is randomness on display... assuming one is not convinced by the fact that there are no two retinas the same or faces or fingerprints... and they have never looked up in the sky to see the clouds and have never sat by a brook and noticed the turbulent flow and have never seen images such as those below and have never bothered to THINK altogether.


The human retina is a thin tissue composed of neuralcells that is located in the posterior portion of the eye. Because of the complex structure of the capillaries that supply the retina with blood, each person’s retina is unique. The network of bloodvessels in the retina is so complex that even identical twins do not share a similar pattern.

Your fingerprints are unique. No two are the same, not even on the same person or on identical twins.

[imgw=300]http://www.internationalskeptics.com/forums/imagehosting/thum_512826459ea3d353cd.png[/imgw] [imgw=320]http://www.internationalskeptics.com/forums/imagehosting/thum_512826459ded9b9c64.jpg[/imgw]​
 
Last edited:
It is randomness on display... assuming one is not convinced by the fact that there are no two retinas the same or faces or fingerprints... and they have never looked up in the sky to see the clouds and have never sat by a brook and noticed the turbulent flow and have never seen images such as those below and have never bothered to THINK altogether.
[imgw=300]http://www.internationalskeptics.com/forums/imagehosting/thum_512826459ea3d353cd.png[/imgw] [imgw=320]http://www.internationalskeptics.com/forums/imagehosting/thum_512826459ded9b9c64.jpg[/imgw]​

Sounds random to me. But it doesn't really matter. That many things are probabilistic doesn't mean an imaginary being is or is even a possibility of being the cause.

I say there is no god because in thousands of years, no one can demonstrate one.

There isn't a reason of any merit that we should believe, let alone even consider that a magic daddy is the cause of anything.
 
The above post led me to write a little WebApp to play with to see the result of coin tosses varying from 10 at a time to 10,000,000 at a time
Without knowing the specifics of the RNG this is not a definitive test.

However, your results highlight the fact that if you do runs of n Bernoulli trials then the absolute spread of results varies as the square root of the number of trials and the relative spread of results varies as the inverse of the square root of the number of trials.

IE if you increase the number of trials then the absolute deviation from the mean (=np) increases and the relative deviation from the mean decreases.
 
Without knowing the specifics of the RNG this is not a definitive test.

However, your results highlight the fact that if you do runs of n Bernoulli trials then the absolute spread of results varies as the square root of the number of trials and the relative spread of results varies as the inverse of the square root of the number of trials.

IE if you increase the number of trials then the absolute deviation from the mean (=np) increases and the relative deviation from the mean decreases.


In other words RANDOMNESS... not "randomness"... well done... finally you have it!!!:thumbsup:
 
It's not even random. Like .. at all. It's pseudorandom. It's 100% deterministic. What you test is quality of the generator. Not reality.


Pseudo-random in computer random number generators means that an algorithm generated the sequence.... and the set of data is random in its arrangement.... but because it is algorithmic then the sequence will always generate the same set of random numbers if the same starting point is used (i.e. a seed).

And therein lies the BEAUTY of pseudo-random number generators.

The fact that you can have a set of random numbers that can be repeated is vital for testing and experimenting.

But... if the SEED... i.e. the atarting off point for the algorithm is changed then a totally different set of numbers is generated that is RANDOMLY different than the previous set.

Which is yet another very useful quality of pseudo-number generators.... in that you can now have two sets of random number randomly different from each other but can be repeated because you know the starting off SEED and of course the algorithm

However... if you do not know the SEED and you use a different seed all the time that you have no way of knowing or determining then the total set of random numbers is not pseudo-random anymore despite it being still algorithmic.

Of course all this is because we are using a computer and we want to SIMULATE things like REAL LIFE randomness.

Moreover... if the SEED is random then the whole process is random....

So despite the limitation of using a computer you can still have a TRUE random number generator by having a NATURAL SOURCE of randomness from REALITY... e.g. TIME for the easiest way to do it on a computer... but more fancy equipment can use radio signal noise or even the noise in the computer's own circuitry or for really fancy stuff using background microwave noise or radiation sources etc.

For the system I am using the SEED is randomized by using microsecs ticks of the computer's clock and thus every time you run the algorithm unless you can repeat the exact same microsecond of time and can predict when the key stroke happened to start the process off... it is random.

The other way to do it... is to actually get a coin and start tossing for 10,000,000 times and recording the results and then repeating that for say 150 times... how long do you think it will take?

However... this is a simulation of reality... reality is still random... fully random and the computer simulation gives us an extremely good simulation of this... without having to spend the rest of one's life doing the experiment.
 
Last edited:
No, that only makes the first number truly random. The rest is again affected by the quality of the generator. Sure, modern pseudorandom generators are very good. Like for example they will return very similar number of head and tails. But that's the thing. It's been designed that way. It's like testing if first million integers has the same amount of odd and even numbers. What's the point ?
 
The above post led me to write a little WebApp to play with to see the result of coin tosses varying from 10 at a time to 10,000,000 at a time

So you can set the number of coin tosses you would like to see the results for and then tell the app to flip the coin that many times.... it will give you a table of the % of heads and tails for each round you go... and also a running average for the rounds.

Use it to see how even if you go up to 10,000,000 tosses you still are not going to get a precise 50% and even the running average still is not 50%.

If you try 10,000,000 it might take some time depending on the computer you are using... on a good computer should not take more than 0.5 secs for each try... on my computer takes much less and it is a 5 years old computer.... on my iPhone 6plus it takes fraction of a second and on my iPad6 it takes much less than a second.


Is the amount it is off consistently higher or lower than 50%.
 
A single coin toss produces an unpredictable result. But we can predict the approximate results of ten thousand coin tosses. Now, is this random?
The above post led me to write a little WebApp to play with to see the result of coin tosses varying from 10 at a time to 10,000,000 at a time

So you can set the number of coin tosses you would like to see the results for and then tell the app to flip the coin that many times.... it will give you a table of the % of heads and tails for each round you go... and also a running average for the rounds.

Use it to see how even if you go up to 10,000,000 tosses you still are not going to get a precise 50% and even the running average still is not 50%.

I see the problem.
 
Unless you have a mechanism to force the coin into a flat position, you have to account for times that a coin does not display heads or tails, but ends up in some form of edge condition.

In sporting events, I've seen this happen often, and usually results in another coin toss.

In less formal environments, it usually results in much hilarity.

Typically the coin bounces, then spins on its axis, and some other rare circumstance causes it to stop spinning, but remain on its edge.

Also in the real world, be very wary of anyone who catches the coin in one hand then slaps it down onto another surface.

It is very easy to have a palmed coin in the 'favourable' position concealed in the catching hand and perform a substitution as part of the catch.

Back when I was interested in magic, I knew a person who claimed to be able to detect the face of the coin in the palm of his hand, and always slap it down 'heads-up' if he caught the coin (no matter who tossed it).

To this day I don't know if he was doing what he claimed or if he was performing a substitution.

I did learn the method for 'flipping and slapping' a coin from one hand to another, and choosing which face I left upwards, that technique is really easy. (You choose to rotate your hand around the coin, or rotate the coin with the hand, it is extremely difficult for an observer to determine which has been done).

It's possible that he was observing the coin in his hand, and then flipping or not-flipping when he rotated his hand.

My usual gag for that one, is to ask someone for a coin, and then immediately exclaim: "Wow! That's a double headed coin! Where did you get that?" followed by 'flipping' the coin from hand to hand with the 'head' side always face up, and returning the coin directly and visibly from my hand to theirs.

Because of things like this, coins are not 'caught' when a coin toss is used in sporting events, and are able to end up in the 'edge' position.

:D
 
Last edited:
Unless you have a mechanism to force the coin into a flat position, you have to account for times that a coin does not display heads or tails, but ends up in some form of edge condition.
Those tosses are preemptively ignored. As you say:

In sporting events, I've seen this happen often, and usually results in another coin toss.

Any series of heads and tails can be taken as a series where the coin landed either heads or tales, regardless of whether the occasional edge condition occurred along the way.

Alternatively, Leumas's generator does indeed have a mechanism to force the coin into a flat position, insomuch as it eschews simulating a physical coin entirely.
 
What's the point ?


The whole point of the app was to play with the coin flip without having to actually spend the rest of one's life doing so in order to see how random coin tosses never really asymptotically approach a deterministic 50-50 result if only one approaches an infinite number of tosses.

Which illustrates that a random process is indeterministic despite the fact that we can have a stochastic algorithm for predicting a spread for the results around an average (e.g. normal distribution).

My app allows a person to PLAY and EXPERIMENT with numbers of tosses that would take years to do otherwise.


... The rest is again affected by the quality of the generator. Sure, modern pseudorandom generators are very good. ...


OK... I took your remarks into consideration... although the quick (time wise) PRNG I was using is VERY good indeed... but I agree it is not THE BEST.

Accordingly... to address your point I made a new version of the app Coin Flipper 2

Now I am using a Cryptographic algorithm...

Of course there is a time cost... so now 1,000,000 flips at a time takes a fraction of a second instead of no noticeable time delay as before.... also 10,000,000 flips at a time will take a few seconds (on my computer ~3).

So doing many tries of 10,000,000 flips at a time is a bit tedious... but can be easily done... 1,000,000 flips at a time is much less tedious but still is not as fast as it was with version 1 of Coin Flipper

Note: You can always close the app if your computer takes too long on the 10,000,000 flips just close the browser tab.

BSI evaluation criteria
The German Federal Office for Information Security (German: Bundesamt für Sicherheit in der Informationstechnik, BSI) has established four criteria for quality of deterministic random number generators.[21] They are summarized here:
  • K1 – There should be a high probability that generated sequences of random numbers are different from each other.
  • K2 – A sequence of numbers is indistinguishable from "truly random" numbers according to specified statistical tests. The tests are the monobit test (equal numbers of ones and zeros in the sequence), poker test (a special instance of the chi-squared test), runs test (counts the frequency of runs of various lengths), longruns test (checks whether there exists any run of length 34 or greater in 20 000 bits of the sequence)—both from BSI[21] and NIST,[22] and the autocorrelation test. In essence, these requirements are a test of how well a bit sequence: has zeros and ones equally often; after a sequence of n zeros (or ones), the next bit a one (or zero) with probability one-half; and any selected subsequence contains no information about the next element(s) in the sequence.
  • K3 – It should be impossible for an attacker (for all practical purposes) to calculate, or otherwise guess, from any given subsequence, any previous or future values in the sequence, nor any inner state of the generator.
  • K4 – It should be impossible, for all practical purposes, for an attacker to calculate, or guess from an inner state of the generator, any previous numbers in the sequence or any previous inner generator states.
For cryptographic applications, only generators meeting the K3 or K4 standards are acceptable.
 
Last edited:
I also forgot to add... in Coin Flipper 2 I took account of the edge landing... I am not reporting it in the data but it is accounted for by not being a heads or tails in the final count of those. Although while I was doing testing of the algorithm I never encountered even one occurrence of this... but I only did a few hundred test only... it is indeed a very low probability. Maybe in V3 I might add a mechanism for reporting it if it occurs.

Now let's have a look again at something that illustrates the randomness of the process preventing any asymptotic approach to 50-50 and it will constantly oscillate in favor of heads one time or tails the other and will continue to do so because... it is a random process.
1000 rounds @ 1,000 flips a go (147 more H)
Running Average H = 50.0147%
Running Average T = 49.9853%
100 rounds @ 10,000 flips a go (348 more T notice worse discrepancy than before and the flip to T)
Running Average H = 49.9652%
Running Average T = 50.0348%
10 rounds @ 100,000 flips a go (333 more T)
Running Average H = 49.9667%
Running Average T = 50.0333%
1 round @ 1000,000 flips a go (953 more H notice the much worse discrepancy)
Running Average H = 50.0953%
Running Average T = 49.9047%

Now lets have a look at this test....

20 rounds @ 10,000,000 flips a go (2 more H notice the very low discrepancy)
Running Average H = 50.0002%
Running Average T = 49.9998%
22 rounds @10,000,000 flips a go (7 more T)
Running Average H = 49.9993%
Running Average T = 50.0007%
23 rounds @10,000,000 flips a go (even)
Running Average H = 50.0000%
Running Average T = 50.0000%
24 rounds @10,000,000 flips a go (9 more H notice getting worse discrepancy)
Running Average H = 50.0009%
Running Average T = 49.9991%
25 rounds @10,000,000 flips a go (5 more H)
Running Average H = 50.0005%
Running Average T = 49.9995%
28 rounds @10,000,000 flips a go (8 more H)
Running Average H = 50.0008%
Running Average T = 49.9992%
30 rounds @10,000,000 flips a go (18 more H notice even worse discrepancy)
Running Average H = 50.0018%
Running Average T = 49.9982%​
 
Last edited:

Back
Top Bottom