Free Tarot Readings

Fair coin toss


Imagine a line of people flipping coins in order. If the first man flips heads, he wins, and the second man loses. A loser cannot flip. The first man flips again, since he won, and now flips tails. He loses and the 3rd man is the winner. The 3rd man flips… etc

This continues to the last man. Last man standing wins all.

How do we even odds so latest ones are not more likely to win.

Example: with no intervention in changing the odds, the last one to flip a coin is more likely to win than the first in line, as he has challenged less people. The first person must beat all opponents between himself and the last person.

To make it fair to all, we need to decrease the next challengers odds. But by how much? By 1 divided by (number of flips + 1). So 2nd challenger (and 1st) have 1/2 chance to win. The 3rd challenger has a 1 in 3 chance to win, etc.

OK, so my analogy is not perfect. You can’t change the odds on one coin flip. But you could increase the number of coin flips on each play, or you could switch to many sided dice…

Javascript code

<script>

//line of people flipping coins in order. how do we even odds so latest ones are not more likely to win

var number_of_people = 10;
var number_or_runs = 10000;

var wins =[];
for (var run = 1 ; run <= number_or_runs ; run++){
        var last_winner = 1;
        for (var person = 1 ; person <= number_of_people ; person++){
                var win = Math.floor(Math.random() * ( person ) ) + 1;
                if(win == 1){
                        last_winner = person;
                }

        }
        if (typeof wins[last_winner] === 'undefined') {
                wins[last_winner] = 0;
                }
        wins[last_winner]++;
}

document.write( 'Times each man won:' );
document.write( wins.toString() );

</script>

JS output:

PHP code

/*
$number_of_people = 10;
$number_or_runs = 1000;
$wins = array();

for ($run = 1 ; $run <= $number_or_runs ; $run++){
        $last_winner = 1;
        for ($person = 1 ; $person <= $number_of_people ; $person++){
                $win = rand( 1 , $person);
                if($win == 1){
                        $last_winner = $person;
                }

        }
        if( ! isset( $wins[$last_winner] ) ) {
                $wins[$last_winner] = 0;
                }
        $wins[$last_winner]++;
}
*/