Sub Menu contents

Unit 4

Exploring Computing

Animation, Simulation & Modeling

4.1 Unit Overview

4.2 Android Mash Tutorial

4.3 Android Mash Projects

4.4 Logo Part 1

4.5 Coin Flip Simulation Tutorial

4.6 Coin Flip Experiment

4.7 Pseudo Random Numbers

4.8 Coin Flip Simulation Projects

4.9 Real World Models

4.10 Abstraction Inside the CPU

4.11BB Privacy

4.12 Wrap Up

QR Code for Coin Flip App

Coin Flip Experiment

Coin Flip Experiment: In this lesson you will use a pre-built app, CoinFlipExperiment, to conduct an experiment aimed at determining how ‘good’ App Inventor is at generating random numbers.

The app will let you ‘flip a coin’ N times and display the results. You should record and tally the results and calculate the average percentage of heads. The expectation is that as N gets large, the average should approach 50%.

Unit Objectives

Here are some things you should know about how computers and computer languages (App Inventor) implement randomness:

Our hypothesis for this experiment: App Inventor's PRNG provides a good model of randomness.

Perform the following steps.

  1. Form a team of several students.
  2. Repeatedly run the app on each device and record the number of heads and tails received in each trial. Do at least 20 runs (trials) among the team. The maximum number of "flips" per trial is 100. Your team should have at least 2000 "flips".
  3. Tally your results and calculate the percentage of heads for each trial. In addition, calculate the cumulative number and percentage of heads after each trial. For example, after the 5th trial of 100 flips, your table will show the number and percentage of heads for 500 flips.
  4. Record your teams results for each trial in a neatly organized table. That is, if you did 20 trials of 100 coin flips each, your table should have 20 rows of results, with the percentage for each trial along with the cumulative numbers.
  5. Here is a Google spreadsheet sthat you can use to record your data. Just enter your data in columns B and C. The rest of the columns will be calculated automatically.
  6. According to your results, does App Inventor's PRNG provide a good model of randomness?
  7. A friend claims that flipping a coin 100 times and finding that it comes up heads only 45% of the time shows that the coin is biased. How should you reply?

  8. To get started, open use the QR code in the left column to download the Coin Flip Experiment App.

    Make sure that you update your Google Site Portfolio