4.6. Coin Flip Experiment optional¶
This lesson reinforces the enduring understanding that models and simulations use abstraction to generate new understanding and knowledge. In this case students will use the coin flip model in an experiment that aims to test a hypothesis about the quality of App Inventor's randomnumber generator. If App Inventor's randomnumber generator is a good one, then if you simulate a coin flip many times and keep track of the outcomes, it should come up heads around 50% of the time. Students will use a prebuilt app to run the coinflip experiment many times and tabulate the results.
Professional Development
Complete the activities for Mobile CSP Unit 4 Lesson 4.6: Coin Flip Experiment.
Materials
 Access to computer, laptop, or Chromebook (install the Companion app on Chromebooks)
 Access to mobile device with the Companion app installed or access to the emulator installed on the computer or laptop.
 Paper and pencil to record observations or access to a spreadsheet
 POGIL Roles
 Prebuilt Coin Flip Experiment app (QR code to download APK)
 Optional  Source code for app  If you are using the emulator, you will need to download the source code, open it in AI2, and then run the emulator to use the app.
4.6.1. Learning Activities¶
Estimated Length: 45 minutes
 Hook/Motivation (5 minutes): In the last lesson, students created the Coin Flip Simulation app. Using ThinkPairShare technique, ask the students to think about whether or not this was a good approximation of the randomness of a coin flip and explain why or why not. Ask them how they could test whether or not it was a fair coin and how they would know that. Have the class write down a hypothesis for the experiment.
 Experiences and Explorations (25 minutes): A fair coin is one that would flip a heads 50% of the
time and tails the other 50%. So, the coin flips in the app should be 50% heads and 50% tails. However, we
would need to test this with many flips to get more accurate data. Ask them how many flips do they think
are needed? (Answers of 100 or less are too few. Answers above 1000 will be more accurate.) Ask them how long
they think it would take them to flip a coin 1,000 times by hand and then observe how long it takes them to do
in the app.
 Optional  Source Code Review: Show the students the source code for the app. Have them explain in their own words what the algorithm does. What if the experiment was based on a faulty algorithm? Note that this app checks that the input into the text field is a valid number between 1 and 100 — otherwise, faulty user input would be able to crash the app.
 Experiment Activity: NOTE: This activity has been recast as a POGIL activity for 201617. See
the description of the activity on the studentfacing branch.
The POGIL teams will download the Coin Experiment App and run the experiment. The app lets the user
flip a coin N times (N <= 100).
Teams should run the experiment 10 or 20 times, generating 1000 or 2000 coin flips, and record the results in
a table, as described in the lesson. The format is given in the student lesson.
NOTE: The student lesson has a link to this Google spreadsheet. Each POGIL team should make their own copy and then use it to enter their data. It will automatically calculate percentages. Here is a classroom spreadsheet that contains the POGIL spreadsheet plus a spreadsheet that can be used to gather data from each of the POGIL teams.
Note: If you are using emulators, use the link below the barcode to download the source code for the app. You can then run it on your emulator from App Inventor.  Discussion: Each group should share their results data, either on the board or through a shared Google Doc. Discuss the results and whether or not the experiment's hypothesis is true: that App Inventor’s random integer block is a good approximation of the process of randomly generating a 1 half the time and a 2 half the time. One idea for discussing the class's results as a whole might be to have the teams input their totals into a Google spread sheet, such as: Experimental results spreadsheet.
 Rethink, Reflect and/or Revise (10 minutes): Have students complete their portfolio reflections.
AP Classroom
The College Board's AP Classroom provides a question bank and Topic Questions. You may create a formative assessment quiz in AP Classroom, assign the quiz (a set of questions), and then review the results in class to identify and address any student misunderstandings.The following are suggested topic questions that you could assign once students have completed this lesson.
Suggested Topic Questions:
 Topic 3.16 Simulations
Assessment Opportunities
Solutions:
 Note: Solutions are only available to verified educators who have joined the Teaching Mobile CSP Google group/forum in Unit 1.
 Quizly Solutions
 Portfolio Reflection Questions Solutions
Assessment Opportunities
You can examine students’ work on the interactive exercise and their reflection portfolio entries to assess their progress on the following learning objectives. If students are able to do what is listed there, they are ready to move on to the next lesson.
 Interactive Exercises:
 Portfolio Reflections:
LO X.X.X  Students should be able to ...  In the XXX App, look for:
Differentiation: Enrichment
If they haven't already, students should review the source code and explain in their own words what it does. Then, have students rewrite the ButtonGo.Click algorithm in pseudocode, pointing out where selection and repetition structures are used.
Background Knowledge: Pseudorandomness
Even if you don't use the pseduorandom numbers lesson in class, the background presentation on how pseudorandom number generators (PRNG's) work would be helpful to review.
4.6.2. Professional Development Reflection¶
Discuss the following questions with other teachers in your professional development program.
 How does this lesson help students toward the enduring understanding AAP3?

I am confident I can teach this lesson to my students.
 1. Strongly Agree
 2. Agree
 3. Neutral
 4. Disagree
 5. Strongly Disagree
Q2: What questions do you still have about the lesson or the content presented?