This topic summary covers Knowledge Organiser: Random Numbers within Merge Sort for GCSE Computer Science. Revise Merge Sort in 3.1 Fundamentals of Algorithms for GCSE Computer Science with 16 exam-style questions and 10 flashcards. This topic appears less often, but it can still be a useful differentiator on mixed-topic papers. It is section 8 of 8 in this topic. Use this topic summary to connect the idea to the wider topic before moving on to questions and flashcards.
Knowledge Organiser: Random Numbers
Key Terms
- Random number: An unpredictable value chosen from a range
- Pseudo-random: Numbers that appear random but are generated by a mathematical formula
- Seed: A starting value used by a random number generator; the same seed produces the same sequence
- random(min, max): GCSE pseudocode function that returns a random integer between min and max inclusive
Must-Know Facts
- Computers cannot generate truly random numbers — they use algorithms
random(1, 6)simulates a dice roll; both 1 and 6 are possible outcomes- random() returns integers (whole numbers), not decimals
- Uses of random numbers: games, simulations, security, testing, art
- The same seed value always produces the same sequence of pseudo-random numbers
Key Concepts
- Syntax:
num = random(min, max)— both endpoints are inclusive - Dice roll example:
roll = random(1, 6) - Random numbers in security: used for encryption keys and password generation
- Random numbers in games: enemy spawning, card shuffling, procedural generation
Common Mistakes
- Saying computers generate truly random numbers: Computers use algorithms (pseudo-random number generators) — the numbers appear random but are calculated mathematically
- Thinking both endpoints are not included:
random(1, 6)can return both 1 AND 6 — the range is inclusive at both ends - Confusing seed and random number: The seed is the starting value for the generator; the random number is the output — the same seed always produces the same sequence
- Expecting random() to return a decimal: The GCSE pseudocode
random()function returns an integer (whole number) — it does not produce floating-point values
Practice questions for Merge Sort
Which design strategy does merge sort use?
Describe how merge sort works. You should include what happens in both the divide and merge phases.