
TERM I 1-2 3-4 Generate pseudo-random numbers and sequences.
Presentation
•
Other
•
12th Grade
•
Hard
Аңсар Әкім
Used 9+ times
FREE Resource
11 Slides • 12 Questions
1
Welcome!
Programming
12 grade
2
Programming, Grade 12
1st term | 2nd term | 3rd term | 4th term |
|---|---|---|---|
Unit 12.1А: Python libraries. Generate pseudo-random numbers and sequences. Creating images. Sound processing. | Unit 12.2A: PyGame
Graphic primitives. | Unit 12.3А: PyGame (continuation) Using the game counter. Object collisions. Game development.
| Unit 12.4A: Chatbot development.
Chatbot (Vkontakte) Chatbot (Telegram). |
3
What do we already know?
4
Unit 11.1А: Basic structures of the Python programming language
Unit 11.2А: Data structures.
Unit 11.3А: Data structures (continuation).
Unit 11.3B: Functions.
Unit 11.4A: Object Oriented Programming (ООP)
Programming 11 grade
5
12.6.1.1 uses the functions of the library Random to get a pseudo-random number;
12.6.1.2 Determine the function of the library Random for the specified task;
12.6.1.3 Identify code snippets that use random sequence generation;
12.6.1.4 Solve problems using random numbers and random sequences.
Generate pseudo-random numbers and sequences.
6
7
8
Let's solve tasks!
1. Generate Random Numbers: Generate a sequence of random numbers between a given range.
2. Simulate Coin Toss: Simulate a coin toss using the random function.
3. Randomize List Elements: Shuffle the elements of a list randomly.
4. Random Password Generator: Generate a random password with a given length.
5. Random Sample from List: Select a random sample of elements from a list.
6. Guessing Game Task:
Create a guessing game where the computer generates a random number between a specified range, and the player has to guess the number. The game should provide hints to the player, indicating whether their guess is too high or too low. The player should continue guessing until they correctly guess the number.
9
Multiple Choice
LO: 12.6.1.1 Which library is used to generate pseudo-random numbers in Python?
math
random
rand
pseudo
10
Multiple Choice
LO: 12.6.1.2 If you want to generate a random integer between 5 and 10 (inclusive), which function would you use from the random library?
randint(5, 10)
randrange(5, 11)
choice([5, 6, 7, 8, 9, 10])
uniform(5, 10)
11
Multiple Choice
LO: 12.6.1.1 What function from the random library is used to generate a random floating-point number between 0 and 1?
randrange()
uniform()
random()
choice()
12
Multiple Choice
LO: 12.6.1.2 To shuffle the elements of a list my_list randomly, which function would you use from the random library?
shuffle(my_list)
randomize(my_list)
random.shuffle(my_list)
mix(my_list)
13
Multiple Choice
LO: 12.6.1.3 Which code snippet demonstrates the correct way to generate a random sequence of 5 lowercase letters?
sequence = random.choice('abcdefghijklmnopqrstuvwxyz', 5)
sequence = random.sample('abcdefghijklmnopqrstuvwxyz', 5)
sequence = random.shuffle('abcdefghijklmnopqrstuvwxyz')[:5]
sequence = random.random('abcdefghijklmnopqrstuvwxyz', 5)
14
Let's solve tasks!
Learning Objective: 12.6.1.1:
Task 1: Dice Roll Simulation Create a program that simulates rolling a fair 6-sided die 50 times using the random library. Count and display the frequency of each roll outcome (1 to 6).
Learning Objective: 12.6.1.2
Task 2: Random Password Generator Write a program that generates a random password of a given length using the random library's functions. Allow users to choose whether to include uppercase letters, lowercase letters, digits, and special characters.
Task 3: Randomized Selection Design an algorithm to select a random element from a given list using the random library. Implement it and test it with various input lists.
15
Multiple Choice
LO: 12.6.1.3 Which of the following code snippets demonstrates the correct way to select two items from the list my_list randomly?
random.random(my_list, 2)
random.choice(my_list, 2)
random.sample(my_list, 2)
random.shuffle(my_list)[:2]
16
Multiple Choice
LO: 12.6.1.1 Which of the following statements is true about pseudo-random numbers?
Pseudo-random numbers are truly random and unpredictable.
Pseudo-random numbers are generated using physical randomness sources.
Pseudo-random numbers are generated using deterministic algorithms.
Pseudo-random numbers are generated using a hardware random number generator.
17
Multiple Choice
LO: 12.6.1.2 You want to generate a random boolean value (True or False). Which function would you use from the random library?
random.choice([True, False])
random.boolean()
random.random_bool()
random.randint(0, 1)
18
Learning Objective: 12.6.1.3:
Task 4: Random Word Generator Develop a program that generates a random word by selecting characters randomly from a given set. Print the generated word.
Task 5: Shuffled Sentence Write a program that takes a sentence as input and randomly shuffles the order of words using the random library. Display the shuffled sentence.
Task 6: Randomized Quiz Questions Create a quiz application that displays multiple-choice questions with randomized answer options. Use the random library to shuffle the answer choices.
Learning Objective: 12.6.1.4:
Task 7: Casino Game Simulation Develop a simulation of a imple casino game (e.g., rolling dice for points) using the random library. Keep track of player scores over multiple rounds.
19
Multiple Choice
LO: 12.6.1.3 Which code snippet demonstrates the correct way to randomly shuffle the characters in a string my_string?
random.shuffle(my_string)
shuffled_string = ''.join(random.sample(my_string, len(my_string)))
shuffled_string = my_string.random_shuffle()
shuffled_string = random.shuffle_str(my_string)
20
Multiple Choice
LO: 12.6.1.2 What is the purpose of the random.seed() function in the random library?
To generate truly random numbers.
To set the range for random numbers.
To initialize the pseudo-random number generator's internal state.
To generate cryptographically secure random numbers.
21
Multiple Choice
LO: 12.6.1.3 You want to generate a list of five random integers between 1 and 100. Which code snippet accomplishes this?
random.integers(1, 100, 5)
random.randint(1, 100, 5)
[random.randint(1, 100) for _ in range(5)]
random.sequence(1, 100, 5)
22
Let's solve advanced tasks!
1 . Random Walk Simulation: Simulate a 2D random walk starting from a central point. Generate a series of random steps (up, down, left, right) and visualize the path.
2. Randomized Permutation Generation: Generate a random permutation of numbers from 1 to N.
3. Randomized String Generation: Generate a random string of a certain length using a given set of characters.
4. Randomized Game Strategies: Develop a simple two-player game (like Rock-Paper-Scissors) where each player uses a randomized strategy.
5. Randomized Binary Search: Implement a randomized version of the Binary Search algorithm to find an element in a sorted array.
23
Poll
Thank you for completing this learning module on generating pseudo-random numbers and sequences using the random library. Your feedback is important to us. On a scale of 1 to 5, how would you rate your understanding of the topic after completing this module?
1: Very Limited Understanding
2: Limited Understanding
3: Moderate Understanding
4: Good Understanding
5: Very Good Understanding
Welcome!
Programming
12 grade
Show answer
Auto Play
Slide 1 / 23
SLIDE
Similar Resources on Wayground
19 questions
Returner: Duty Protocol Refresher
Presentation
•
University
17 questions
Least Squares Regression Line Practice
Presentation
•
12th Grade
18 questions
Basic Probability
Presentation
•
11th - 12th Grade
15 questions
4.3 Two-Way Tables Probability
Presentation
•
12th Grade
21 questions
Module 5 Topic 7 and 8 Passing and Navigating Rural Roadways
Presentation
•
KG
15 questions
3.3 Functions of Language
Presentation
•
12th Grade
19 questions
A Business Plan
Presentation
•
12th Grade
21 questions
SAT Language and Editing
Presentation
•
11th - 12th Grade
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
Afterschool Activities & Sports
Quiz
•
6th - 8th Grade
19 questions
ROAR Week 2026
Quiz
•
9th - 12th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
15 questions
Cool Tool:Chromebook
Quiz
•
6th - 8th Grade
22 questions
would you rather
Quiz
•
3rd - 11th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
Discover more resources for Other
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
19 questions
ROAR Week 2026
Quiz
•
9th - 12th Grade
10 questions
Fact Check Ice Breaker: Two truths and a lie
Quiz
•
5th - 12th Grade
15 questions
School-Wide Expectations
Quiz
•
9th - 12th Grade
9 questions
Scientific method
Interactive video
•
9th - 12th Grade
20 questions
Flinn Lab Safety Quiz
Quiz
•
9th - 12th Grade
23 questions
Six Parent Functions
Quiz
•
9th - 12th Grade
25 questions
WCHS Sports and Clubs
Quiz
•
9th - 12th Grade