
4.7. Pseudo Random Numbers¶
This lesson describes how computers model randomness using relatively simple mathematical functions, such as modular arithmetic (sometimes called clock arithmetic). It reinforces the enduring understanding that models use abstractions — in this case mathematical constructs — to represent phenomena.
CSP Framework | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||||||||||||||||||||||||||||||||
Enduring Understanding AAP-2: The way statements are sequenced and combined in a program determines the computed result. Programs incorporate iteration and selection constructs to represent repetition and make decisions to handle varied input values. | |||||||||||||||||||||||||||||||||||||||||
Learning Objective AAP-2.C: Evaluate expressions that use arithmetic operators. | |||||||||||||||||||||||||||||||||||||||||
Learning Objective AAP-2.M.a: For algorithms: a. Create algorithms. Learning Objective AAP-2.M.b: For algorithms: b. Combine and modify existing algorithms. | |||||||||||||||||||||||||||||||||||||||||
Enduring Understanding AAP-3: Programmers break down problems into smaller and more manageable pieces. By creating procedures and leveraging parameters, programmers generalize processes that can be reused. Procedures allow programmers to draw upon existing code that has already been tested, allowing them to write programs more quickly and with more confidence. | |||||||||||||||||||||||||||||||||||||||||
Learning Objective AAP-3.E.a: For generating random values: a. Write expressions to generate possible values. Learning Objective AAP-3.E.b: For generating random values: b. Evaluate expressions to determine the possible results. | |||||||||||||||||||||||||||||||||||||||||
Learning Objective AAP-3.F.a: For simulations: a. Explain how computers can be used to represent real-world phenomena or outcomes. Learning Objective AAP-3.F.b: For simulations: b. Compare simulations with real-world contexts. | |||||||||||||||||||||||||||||||||||||||||
Professional Development
Complete the activities for Mobile CSP Unit 4 Lesson 4.7: Pseudo Random Numbers.
Materials
- Computer lab with projection system
- Pseudo Random Numbers: Slides (not narrated) | Handout
- Optional - Paper and pencils for paper-based Chaos activity
4.7.1. Learning Activities¶
Estimated Length: 45 minutes
- Adapted from the Randomness in Stochastic Models lesson plan.
- Hook/Motivation (10 minutes) Ask students for words or situations where they might expect to see randomness present. Write these words on the board.
Show them sets of numbers and ask them which they think are random and which are not.
- 1, 2, 3, 4, 5
- 6, 5, 6, 3, 3
- 4, 4, 4, 4, 4
- 3, 2, 3, 4, 1
What makes numbers random are not the results but the method used to determine the numbers.
Dilbert Joke: Here's a nice cartoon from Scott Adams' Dilbert Cartoon Strip that reinforces the previous point. - For each scenario, ask the students to describe what they would do to ensure their method was random:
- Picking a card from a deck. A: Example - Close your eyes while choosing.
- Rolling a dice. A: Example - Placing the dice in a cup to shake.
- Driving a car to a destination. A: Example - Flip a coin to determine the direction at each intersection.
- Selecting a word in the dictionary. A: Example - Letting the book fall open to a page.
- Can a computer generate random numbers? Why or why not? A: A computer is deterministic, that is, it follows instructions and is incapable of making independent decisions needed for creating a random number. However, some random number generators use information from sensors or human interaction to generate real random numbers. Pseudo-random numbers have faults but are sufficient for most applications.
- Experiences and Explorations (30 minutes):
- Generate Random Sequences (10 minutes): Have the students complete the first set of activities (up to the table) to generate an imaginary sequence of coin flips.
- Optional - Chaos Game (10 minutes): With the students, before you say anything, place three large dots on the board so that they represent the corners of an equilateral triangle. Label the dots A , B, and C. Explain to the class that you are going to start at a random place on the board, place a dot, and call on them one by one to have them choose A, B, or C. Then, place a small dot half way between the last dot drawn and the corner called out by the student. Once everyone has had a chance to call out a corner, ask the class if anyone sees a pattern. Ask what the class thinks will happen if this process is continued for a really long time. Demonstrate the computer version of The Chaos Game, which results in a Sierpinski's triangle pattern emerging. Explain that the seemingly random process resulted in a familiar pattern and that is similar to how pseudo number generators work. (Never seen the Chaos Game? Watch this video to see it in action.)
- Lecture (15 minutes): Either show the videos on Mobile CSP or use the slides to present the material to the students. If you are showing the slides, you can use this handout to have them complete the exercises during the presentation.
- Video (5 minutes): Show the video on slot machines at casinos, which will be needed for their portfolio reflection.
- Rethink, Reflect and/or Revise (5 minutes): Summarize the main points about randomness and then have students complete their portfolio reflection.
4.7.2. Professional Development Reflection¶
Discuss the following questions with other teachers in your professional development program.
- How does this lesson help students toward understanding how pseudo randomness is used to model randomness in computer simulations and games?
- Is there anything else you would need to have or know to teach this lesson effectively? What specific elements of this lesson (examples, activities, formative assessments) might you want to change?
-
I am confident I can teach this lesson to my students.
- 1. Strongly Agree
- 2. Agree
- 3. Neutral
- 4. Disagree
- 5. Strongly Disagree