this can be computed as followsthe probability of not rolling on any single roll is / the probability of not rolling on either the first or the second roll is ( / )*( / )or ( / ) sothe probability of not rolling ten times in row is ( / ) slightly more than we will return to the subject of probability in bit more detail later inferential statistics and simulation the tiny program in figure is simulation model rather than asking some person to roll die multiple timeswe wrote program to simulate that activity we often use simulations to estimate the value of an unknown quantity by making use of the principles of inferential statistics in brief (since this is not book about statistics)the guiding principle of inferential statistics is that random sample tends to exhibit the same properties as the population from which it is drawn suppose harvey dent (also known as two-faceflipped coinand it came up heads you would not infer from this that the next flip would also come up heads suppose he flipped it twiceand it came up heads both time you might reason that the probability of this happening for fair coin ( coin where heads and tails are equally likelywas so there was still no reason to assume the next flip would be heads supposehowever out of flips came up heads / is pretty small numberso you might feel safe in inferring that the coin has head on both sides your belief in whether the coin is fair is based on the intuition that the behavior of sample of flips is similar to the behavior of the population of all flips of your coin this belief seems pretty sound when all flips are heads supposethat flips came up heads and tails would you feel comfortable in predicting that the next flips would have the same ratio of heads to tailsfor that matterhow comfortable would you feel about even predicting that there would be more heads than tails in the next flipstake few minutes to think about thisand then try the experiment using the code in figure the function flip in figure simulates flipping fair coin numflips timesand returns the fraction of flips that came up heads for each fliprandom random(returns random floating point number between and numbers less than or greater than are treated as heads or tails respectively the value is arbitrarily assigned the value tails given the vast number of floating point values between and it is highly unlikely that this will affect the result