Single lesson · Written for AQA GCSE Computer Science (8525)

Random numbers and programming practice – AQA GCSE Computer Science lesson (8525)

Pupils learn to use random number generation in the class's language in a complete program with selection and iteration.

Also in a bundle Cyber Security and Robust Programs – AQA GCSE Computer Science lessons (8525) 14 lessons for £39 · save 30% on buying separately

Lesson 13 of 14 in unit 11.1 Cyber Security and Robust Programs, taught in Year 11, Autumn 1. It answers one big question: How can a program pick a winner fairly by chance?

By the end, pupils can use random number generation in the class's language in a complete program with selection and iteration.

The Build (the main task)
Write a program for Kickstand's prize draw game that: inputs the number of entries; picks a random winning number from 1 to the number of entries; lets the user guess the winning number up to three times; outputs Too high, Too low or Correct after each guess, stopping early if the guess is correct; outputs the winning number if it was not guessed. You should use indentation and meaningful identifiers. (8 marks)
Support version
Part-filled code with the random line and the loop written.
Challenge
Write the line that picks the winning number for a draw with 60 entries in AQA pseudo-code, using RANDOM_INT, and explain why the result is unpredictable. (4 marks) Write a program that simulates rolling two dice 10 times and outputs Doubles: followed by how many times both dice showed the same number. (6 marks)
Real-world link
Picking the prize-draw winner fairly for Kickstand's launch.
Key words
Random number generation, Range and Unpredictable, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Every random function includes both numbers it is given”; “The random number should be made inside the guessing loop”.
AQA 8525 specification
3.2.9 (random number generation).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Cyber Security and Robust Programs unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

Choose your school's Paper 1 language when you buy: C#, Python or VB.NET. You get that language's files: every program, code example, worked answer and programming task is written in it, and lessons with no code are the same in all three. Algorithms are also shown in AQA pseudo-code, as in the exam.

An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Random numbers and programming practice - Quiz Quiz Trade Cards
  • Single-teacher licence: use and adapt it with your own classes
  • Your choice of Paper 1 language: C#, Python or VB.NET

More for GCSE Computer Science (AQA)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.